# Golden Grid Portfolio

> A portfolio section about the small things: handles, eaves, ceilings. The details fill a Golden Grid, a rectangle cut into Fibonacci squares, and the biggest square is the one named on the right. Every few seconds the next detail rides the golden spiral up into it while the rest move up a size; a click on any square, or the arrows, brings that one up.

A Portfolio Section block from KeyframeUI: a whole landing-page section built around the Golden Grid component, free to install as source with the shadcn CLI. Built with React and Tailwind CSS.

- Live preview: https://keyframeui.com/blocks/portfolio-sections/golden-grid-portfolio
- Category: Portfolio Sections
- Built with: [Golden Grid](https://keyframeui.com/components/golden-grid.md)
- npm dependencies: clsx, tailwind-merge

## Installation

Register the @keyframeui registry in `components.json` once per project:

```json
{
  "registries": {
    "@keyframeui": "https://keyframeui.com/r/{name}.json"
  }
}
```

Then add the block. It lands in `components/golden-grid-portfolio.tsx`, and the CLI also adds the components it's built with (`components/ui/golden-grid.tsx`) and `lib/utils.ts`, and installs the npm dependencies:

```bash
npx shadcn@latest add @keyframeui/golden-grid-portfolio
```

Or install by URL, without registering the namespace:

```bash
npx shadcn@latest add https://keyframeui.com/r/golden-grid-portfolio.json
```

## Usage

Put it where the section goes. The copy, links and data sit in constants at the top of the file; edit them there.

```tsx
import { GoldenGridPortfolio } from "@/components/golden-grid-portfolio";

export default function Page() {
  return <GoldenGridPortfolio />;
}
```

## Source

```tsx title="components/golden-grid-portfolio.tsx"
"use client";

import * as React from "react";

import { GoldenGrid } from "@/components/ui/golden-grid";

/* ── Content ─────────────────────────────────────────────────
 * Everything you'd change to make the section yours: the copy
 * and the details. The biggest square is the detail named on the
 * right; every few seconds the next one rides the spiral up into
 * it, and a click on any square brings that one up.
 * ─────────────────────────────────────────────────────────── */

/** Amber, dark enough for small text on white: the eyebrow, the counter and focus rings. */
const ACCENT = "#b45309";
const ACCENT_DARK = "#fbbf24";

const EYEBROW = "Details";
const HEADLINE = "A house is won in the last two centimetres.";
const SUBLINE = "We draw every handle, joint and threshold ourselves, then build a full-size one before anything is ordered.";
const LINK = { label: "How we work", href: "#process" };

const square = (id: string) =>
  `https://images.unsplash.com/photo-${id}?auto=format&fit=crop&w=900&h=900&q=80`;

const DETAILS = [
  { src: square("1681157998340-6d848679b149"), alt: "A pointed sandstone arch with a tiled border opening onto an arcade", name: "Tiled arch reveal", project: "Arcade Library", note: "Hand-cut tiles set into the arch's reveal, one colour to each course." },
  { src: square("1727786467215-116f0dbb9696"), alt: "White stairs turning between vivid green walls", name: "Green lime-wash", project: "Casa Verde", note: "The green was mixed on site, then the white stair was cut through it." },
  { src: square("1706541972715-41ea84cf1d1e"), alt: "Arched lattice windows throwing golden light across a patterned floor", name: "Lattice windows", project: "Lattice Room", note: "Timber lattice that lays the afternoon on the floor as a second pattern." },
  { src: square("1762755647813-017e128a4ba0"), alt: "A monstera against a textured orange wall", name: "Burnished orange plaster", project: "Hotel Sal", note: "Three coats of pigmented lime, polished by hand so the courtyard glows at dusk." },
  { src: square("1672865362636-2a1c08284ede"), alt: "A curving white plaster wall beside a stair", name: "Curved stair wall", project: "Curve House", note: "One plaster wall that bends with the stair, with no corner to catch the dust." },
  { src: square("1754390755142-3b4b9ffbd1f3"), alt: "A deep red curtain in a concrete room with steel windows", name: "Red wool curtain", project: "Foundry Loft", note: "A floor-to-ceiling wool curtain that turns one loft into two rooms." },
  { src: square("1576500762874-720db275b3f9"), alt: "Terracotta tiled steps below a sunlit white wall and potted plants", name: "Terracotta treads", project: "Terraço House", note: "Handmade tiles on every tread, with the risers left white." },
];

/* ── Section ─────────────────────────────────────────────── */

const pad = (n: number) => String(n).padStart(2, "0");

export function GoldenGridPortfolio() {
  const [index, setIndex] = React.useState(0);
  const detail = DETAILS[index];
  const count = DETAILS.length;

  const iconButton =
    "grid size-10 place-items-center rounded-full border border-zinc-950/10 transition-colors duration-150 hover:bg-zinc-950/[0.04] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--accent) dark:border-white/15 dark:hover:bg-white/[0.06] dark:focus-visible:outline-(--accent-dark)";

  return (
    <section
      style={{ "--accent": ACCENT, "--accent-dark": ACCENT_DARK } as React.CSSProperties}
      className="overflow-x-clip bg-white text-zinc-950 dark:bg-zinc-950 dark:text-white"
    >
      <div className="mx-auto max-w-6xl px-6 py-20 sm:py-24">
        <div className="max-w-2xl">
          <p className="text-[13px] font-medium text-(--accent) dark:text-(--accent-dark)">{EYEBROW}</p>
          <h2 className="mt-3 text-balance text-[2rem] leading-[1.08] font-semibold tracking-[-0.035em] sm:text-[2.75rem]">{HEADLINE}</h2>
          <p className="mt-4 max-w-lg text-pretty text-base leading-relaxed text-zinc-600 dark:text-zinc-400">{SUBLINE}</p>
        </div>

        <div className="mt-10 grid grid-cols-1 gap-8 lg:mt-12 lg:grid-cols-[minmax(0,1fr)_17rem] lg:items-stretch lg:gap-10">
          <GoldenGrid
            items={DETAILS}
            index={index}
            onIndexChange={(i) => setIndex(i)}
            interval={3.6}
            label="Lath details"
            className="rounded-lg text-zinc-950 dark:text-white"
          />

          <div className="flex flex-col justify-between gap-6 border-t border-zinc-950/[0.08] pt-6 lg:border-t-0 lg:border-l lg:py-1 lg:pl-8 dark:border-white/[0.1]">
            <div aria-live="polite">
              <p className="font-mono text-xs text-zinc-500 tabular-nums dark:text-zinc-400">
                <span className="text-(--accent) dark:text-(--accent-dark)">{pad(index + 1)}</span> / {pad(count)}
              </p>
              <p className="mt-2 text-lg leading-snug font-semibold tracking-[-0.02em] text-balance">{detail.name}</p>
              <p className="text-sm text-zinc-500 dark:text-zinc-400">{detail.project}</p>
              <p className="mt-3 text-sm leading-relaxed text-zinc-600 dark:text-zinc-300">{detail.note}</p>
            </div>
            <div className="flex items-center gap-2">
              <button type="button" aria-label="Previous detail" onClick={() => setIndex((i) => (i - 1 + count) % count)} className={iconButton}>
                <svg viewBox="0 0 16 16" className="size-4" fill="none" stroke="currentColor" strokeWidth="1.6" aria-hidden>
                  <path d="M10 3.5 5.5 8l4.5 4.5" strokeLinecap="round" strokeLinejoin="round" />
                </svg>
              </button>
              <button type="button" aria-label="Next detail" onClick={() => setIndex((i) => (i + 1) % count)} className={iconButton}>
                <svg viewBox="0 0 16 16" className="size-4" fill="none" stroke="currentColor" strokeWidth="1.6" aria-hidden>
                  <path d="M6 3.5 10.5 8 6 12.5" strokeLinecap="round" strokeLinejoin="round" />
                </svg>
              </button>
              <a
                href={LINK.href}
                className="ml-auto rounded-sm text-sm font-semibold underline decoration-zinc-950/20 underline-offset-4 transition-colors duration-150 hover:decoration-current focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-(--accent) dark:decoration-white/25 dark:focus-visible:outline-(--accent-dark)"
              >
                {LINK.label}
              </a>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}
```
