Golden Grid

Fibonacci Bento Grid for React

A grid cut the way the golden spiral cuts a rectangle: Fibonacci squares of 8, 5, 3, 2, 1 and 1, with the featured picture in the biggest. Every few seconds each picture swings one square up along the spiral, growing by about the golden ratio. The next one slides in under the featured picture, which then drops out of the frame, and a new picture grows out of the spiral's eye. Click any square to wind it up to the big one, or drag sideways to turn the spiral.

  • Gallery
  • Layout
  • Motion

Uses clsx, tailwind-merge

Open in ChatGPTOpen in Claude
interval3.2s
duration1.00s
ripple45ms
chambers6
side
gap8px
guidetrue
<GoldenGrid />

The demo follows as you drag.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Golden Grid: A grid cut the way the golden spiral cuts a rectangle: Fibonacci squares of 8, 5, 3, 2, 1 and 1, with the featured picture in the biggest. Every few seconds each picture swings one square up along the spiral, growing by about the golden ratio. The next one slides in under the featured picture, which then drops out of the frame, and a new picture grows out of the spiral's eye. Click any square to wind it up to the big one, or drag sideways to turn the spiral.
This demo, Magazine Stories: A coast magazine's stories of the week, with the featured story's section, headline and read time under the grid, and previous, next and pause buttons.

1. Install it:
   npx shadcn@latest add @keyframeui/golden-grid-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/golden-grid-demo.json instead.)
   It adds the demo, components/golden-grid-demo.tsx, and the component, components/ui/golden-grid.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <GoldenGrid> on its own.

3. These props set its feel. Change them before you change the file:
   - interval (default 3.2): Seconds between steps while it plays on its own.
   - duration (default 1): Seconds a one-chamber step takes. A longer wind takes a little longer per chamber.
   - ripple (default 45): Ms each tile waits after the one ahead of it, so a step runs down the spiral. 0 moves them as one.
   - chambers (default 6): How many Fibonacci squares the grid is cut into, from 4 to 8. Six makes a 13 × 8 rectangle; eight a 34 × 21 one with tiny tiles at the eye.
   - side (default "left"): Which side the big chamber sits on. The spiral winds away from it.
   - gap (default 8): Px between tiles. Small chambers get less, so their pictures stay readable.
   - guide (default true): Draws the golden spiral over the tiles as a hairline in the text color, like a crop overlay.

4. Don't change, in components/ui/golden-grid.tsx:
   - The chambers are a Fibonacci tiling (1, 1, 2, 3, 5, 8…) laid out as the golden spiral lays them out, and a tile moving up a chamber rides the spiral itself, a quarter turn around its eye, so the step reads as the spiral turning, never as tiles cutting straight across. The path (and the tiles' growth) keeps its speed, heading and bend through every chamber and into the way out, so a wind across several chambers glides instead of braking at each one and lurching off.
   - One phase number drives every move (autoplay, clicks, keys, drag). Moves are added on top of each other as segments, so a new one starts from wherever the tiles are, and each tile reads the phase `ripple` ms later per chamber behind the featured one: that delay is the ripple.
   - A tile keeps its item for life (it's keyed by its place in the endless sequence), so no picture is swapped in view. The featured tile waits `TIMING.hold` so the next one slides in under it, then leaves through the open side, solid until it's out; a new tile grows out of the eye.
   - Transform and opacity are written straight to each tile in one rAF loop that stops once everything has landed; React only renders when a tile enters or leaves the window.
   - Reduced motion: no autoplay and no unfurl. A step jumps the tiles to their new chambers and the grid fades back up; dragging still scrubs.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/golden-grid.md

Installation

Add the component on its own with the CLI, or copy the file in by hand.

The CLI writes components/ui/golden-grid.tsx and installs clsx and tailwind-merge. It needs the @keyframeui registry in components.json; add it once per project.

npx shadcn@latest add @keyframeui/golden-grid

Examples

Finished sections built with Golden Grid. Each one installs whole, with the component included.

Studio Team

A design studio's seven people in a portrait grid beside the featured person's name, role and one line about them.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Golden Grid: A grid cut the way the golden spiral cuts a rectangle: Fibonacci squares of 8, 5, 3, 2, 1 and 1, with the featured picture in the biggest. Every few seconds each picture swings one square up along the spiral, growing by about the golden ratio. The next one slides in under the featured picture, which then drops out of the frame, and a new picture grows out of the spiral's eye. Click any square to wind it up to the big one, or drag sideways to turn the spiral.
This demo, Studio Team: A design studio's seven people in a portrait grid beside the featured person's name, role and one line about them.

1. Install it:
   npx shadcn@latest add @keyframeui/golden-grid-team-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/golden-grid-team-demo.json instead.)
   It adds the demo, components/golden-grid-team-demo.tsx, and the component, components/ui/golden-grid.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <GoldenGrid> on its own.

3. These props set its feel. Change them before you change the file:
   - interval (default 3.2): Seconds between steps while it plays on its own.
   - duration (default 1): Seconds a one-chamber step takes. A longer wind takes a little longer per chamber.
   - ripple (default 45): Ms each tile waits after the one ahead of it, so a step runs down the spiral. 0 moves them as one.
   - chambers (default 6): How many Fibonacci squares the grid is cut into, from 4 to 8. Six makes a 13 × 8 rectangle; eight a 34 × 21 one with tiny tiles at the eye.
   - side (default "left"): Which side the big chamber sits on. The spiral winds away from it.
   - gap (default 8): Px between tiles. Small chambers get less, so their pictures stay readable.
   - guide (default true): Draws the golden spiral over the tiles as a hairline in the text color, like a crop overlay.

4. Don't change, in components/ui/golden-grid.tsx:
   - The chambers are a Fibonacci tiling (1, 1, 2, 3, 5, 8…) laid out as the golden spiral lays them out, and a tile moving up a chamber rides the spiral itself, a quarter turn around its eye, so the step reads as the spiral turning, never as tiles cutting straight across. The path (and the tiles' growth) keeps its speed, heading and bend through every chamber and into the way out, so a wind across several chambers glides instead of braking at each one and lurching off.
   - One phase number drives every move (autoplay, clicks, keys, drag). Moves are added on top of each other as segments, so a new one starts from wherever the tiles are, and each tile reads the phase `ripple` ms later per chamber behind the featured one: that delay is the ripple.
   - A tile keeps its item for life (it's keyed by its place in the endless sequence), so no picture is swapped in view. The featured tile waits `TIMING.hold` so the next one slides in under it, then leaves through the open side, solid until it's out; a new tile grows out of the eye.
   - Transform and opacity are written straight to each tile in one rAF loop that stops once everything has landed; React only renders when a tile enters or leaves the window.
   - Reduced motion: no autoplay and no unfurl. A step jumps the tiles to their new chambers and the grid fades back up; dragging still scrubs.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/golden-grid.md

Product Colorways

One chair in seven colorways recolored from a single photo, with the big chamber on the right; the swatches wind the grid to a color and the cart button names it.

Take this demo to your coding agent.
Add this moment from KeyframeUI to our project and adapt it to our content.

Golden Grid: A grid cut the way the golden spiral cuts a rectangle: Fibonacci squares of 8, 5, 3, 2, 1 and 1, with the featured picture in the biggest. Every few seconds each picture swings one square up along the spiral, growing by about the golden ratio. The next one slides in under the featured picture, which then drops out of the frame, and a new picture grows out of the spiral's eye. Click any square to wind it up to the big one, or drag sideways to turn the spiral.
This demo, Product Colorways: One chair in seven colorways recolored from a single photo, with the big chamber on the right; the swatches wind the grid to a color and the cart button names it.

1. Install it:
   npx shadcn@latest add @keyframeui/golden-grid-colorways-demo
   (If the CLI can't find @keyframeui, use https://keyframeui.com/r/golden-grid-colorways-demo.json instead.)
   It adds the demo, components/golden-grid-colorways-demo.tsx, and the component, components/ui/golden-grid.tsx.

2. Make it ours: our copy, data, images and colors. Keep the structure the motion depends on. If we only need the effect, use <GoldenGrid> on its own.

3. These props set its feel. Change them before you change the file:
   - interval (default 3.2): Seconds between steps while it plays on its own.
   - duration (default 1): Seconds a one-chamber step takes. A longer wind takes a little longer per chamber.
   - ripple (default 45): Ms each tile waits after the one ahead of it, so a step runs down the spiral. 0 moves them as one.
   - chambers (default 6): How many Fibonacci squares the grid is cut into, from 4 to 8. Six makes a 13 × 8 rectangle; eight a 34 × 21 one with tiny tiles at the eye.
   - side (default "left"): Which side the big chamber sits on. The spiral winds away from it.
   - gap (default 8): Px between tiles. Small chambers get less, so their pictures stay readable.
   - guide (default true): Draws the golden spiral over the tiles as a hairline in the text color, like a crop overlay.

4. Don't change, in components/ui/golden-grid.tsx:
   - The chambers are a Fibonacci tiling (1, 1, 2, 3, 5, 8…) laid out as the golden spiral lays them out, and a tile moving up a chamber rides the spiral itself, a quarter turn around its eye, so the step reads as the spiral turning, never as tiles cutting straight across. The path (and the tiles' growth) keeps its speed, heading and bend through every chamber and into the way out, so a wind across several chambers glides instead of braking at each one and lurching off.
   - One phase number drives every move (autoplay, clicks, keys, drag). Moves are added on top of each other as segments, so a new one starts from wherever the tiles are, and each tile reads the phase `ripple` ms later per chamber behind the featured one: that delay is the ripple.
   - A tile keeps its item for life (it's keyed by its place in the endless sequence), so no picture is swapped in view. The featured tile waits `TIMING.hold` so the next one slides in under it, then leaves through the open side, solid until it's out; a new tile grows out of the eye.
   - Transform and opacity are written straight to each tile in one rAF loop that stops once everything has landed; React only renders when a tile enters or leaves the window.
   - Reduced motion: no autoplay and no unfurl. A step jumps the tiles to their new chambers and the grid fades back up; dragging still scrubs.
   Its timing is all in the TIMING block at the top of that file.

Docs: https://keyframeui.com/components/golden-grid.md

Props

items Required

TypeT[]

The items, featured first: { src, alt } plus any fields your renderItem reads. Fewer items than chambers repeat down the spiral. Square crops work best; size each image for the big chamber, about twice its width on screen.

index

Typenumber

The featured item. Set it to wind the spiral there; leave it out to let the grid keep its own place.

defaultIndex

TypenumberDefault0

The featured item on first render, when index isn't set.

onIndexChange

Type(index: number, reason: "auto" | "user") => void

Called with the new featured item's index and whether it came from autoplay or a visitor.

autoplay

TypebooleanDefaulttrue

Moves every tile up a chamber every interval on its own. It waits while the pointer is over the grid, while it has focus, during a drag and off screen, and it's off under reduced motion.

paused

TypebooleanDefaultfalse

Holds autoplay, like a pause button.

interval

TypenumberDefault3.2

Seconds between steps while it plays on its own.

duration

TypenumberDefault1

Seconds a one-chamber step takes. A longer wind takes a little longer per chamber.

ripple

TypenumberDefault45

Ms each tile waits after the one ahead of it, so a step runs down the spiral. 0 moves them as one.

chambers

TypenumberDefault6

How many Fibonacci squares the grid is cut into, from 4 to 8. Six makes a 13 × 8 rectangle; eight a 34 × 21 one with tiny tiles at the eye.

side

Type"left" | "right"Default"left"

Which side the big chamber sits on. The spiral winds away from it.

orientation

Type"landscape" | "portrait"Default"landscape"

Landscape is wider than tall with the big chamber at the side, and the featured tile leaves through the bottom; portrait puts the big chamber on top and the featured tile leaves to the side.

gap

TypenumberDefault8

Px between tiles. Small chambers get less, so their pictures stay readable.

guide

TypebooleanDefaulttrue

Draws the golden spiral over the tiles as a hairline in the text color, like a crop overlay.

label

TypestringDefault"Gallery"

Names the gallery for screen readers.

renderItem

Type(item: T, info: GoldenGridTileInfo) => React.ReactNode

Draws a tile's face instead of the plain image. info is { index, echo }, where echo marks a repeat of an item shown nearer the big chamber. Faces are pictures: keep links and buttons outside the grid.

className

Typestring

Extra classes for the grid. Its height follows from its width. Its text color draws the guide. Knobs: --golden-grid-radius (the big tile's corner radius, 1rem; smaller tiles scale it down with them) and --golden-grid-guide (the guide's opacity, 0.6).