# Retro Grid

> React retro grid background: a perspective floor receding to a glowing horizon that scrolls slowly toward the viewer, with angle and cell size props.

- Kind: Motion component (Motion)
- Docs: https://ui.minidev.pro/docs/retro-grid
- Source (registry JSON with the full file): https://ui.minidev.pro/r/retro-grid.json
- License: MIT. One file, yours to edit after install.

## When to use

Use it behind a launch, deploy or developer-tool hero. Reach for DotPattern or BackgroundBoxes for a flat grid, and LampEffect when the headline should be lit rather than grounded.

## Installation

### shadcn CLI (copies the source into your project)

```bash
npx shadcn@latest add @minidev/retro-grid
```

Writes `components/ui/retro-grid.tsx` plus the MiniDev files it is built from (button) and installs its npm dependencies. Older CLI versions: `npx shadcn@latest add https://ui.minidev.pro/r/retro-grid.json`.

### npm package

```bash
npm i minidev-ui-kit lucide-react motion
```

Add the tokens to your global stylesheet once:

```css
@import "tailwindcss";
@import "minidev-ui-kit/styles.css";
@source "../node_modules/minidev-ui-kit";
```

Next.js also needs `transpilePackages: ["minidev-ui-kit"]` in next.config.

## Import

After the shadcn install:

```tsx
import { RetroGrid } from "@/components/ui/retro-grid"
```

From the npm package:

```tsx
import { RetroGrid } from "minidev-ui-kit/premium/retro-grid"
```

## Usage

```tsx
import { RetroGrid } from "@/components/ui/retro-grid"

export function Example() {
  return (
    <RetroGrid />
  )
}
```

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `angle` | `number` | `68` | no | Tilt of the floor in degrees. Higher is flatter and longer. |
| `cellSize` | `number` | `48` | no | Size of one grid cell in pixels, at the front of the floor. |
| `speed` | `number` | `0.7` | no | Cells per second travelled toward the viewer. |
| `horizon` | `number` | `56` | no | Where the floor meets the sky, as a percent of the height from the top. |
| `className` | `string` | - | no |  |
| `children` | `React.ReactNode` | - | no |  |

## Examples

### Flatter and faster

A higher angle lays the floor flatter and longer; cellSize widens the squares and speed is cells per second.

```tsx
<RetroGrid angle={78} cellSize={64} speed={1.4} horizon={50} />
```

### Low horizon

horizon is the percent from the top where the floor meets the sky; push it down and keep the content in the upper part.

```tsx
<RetroGrid horizon={70} speed={0.35} cellSize={40} className="h-72">
  <div className="flex h-full flex-col items-center gap-3 px-6 pt-12 text-center">
    <p className="font-mono text-xs tracking-[0.18em] text-accent-fg uppercase">Lumen Conf · 12 Nov 2026</p>
    <p className="max-w-[20ch] text-3xl font-medium tracking-[-0.035em] text-balance text-fg">The future of closing the books</p>
  </div>
</RetroGrid>
```

### Hero with two actions

Children replace the sample content; a steeper angle keeps the floor short under a taller hero.

```tsx
<RetroGrid className="h-[400px]" angle={62}>
  <div className="flex h-full flex-col items-center gap-5 px-6 pt-12 text-center">
    <span className="rounded-full border border-border bg-surface px-2.5 py-0.5 text-xs font-medium text-fg-muted">Lumen 3.0 ships 14 October</span>
    <p className="max-w-[22ch] text-3xl font-medium tracking-[-0.035em] text-balance text-fg sm:text-4xl">Invoices that close themselves</p>
    <div className="flex flex-wrap items-center justify-center gap-3">
      <Button>Start free trial <ArrowRightIcon /></Button>
      <Button variant="outline">Watch the keynote <PlayIcon /></Button>
    </div>
  </div>
</RetroGrid>
```

## Accessibility

- The whole floor is `aria-hidden` and `pointer-events-none`.
- Under reduced motion the floor is drawn but does not scroll.

## FAQ

### How do I move the horizon or flatten the floor?

`horizon` is where the floor meets the sky as a percent from the top (default 56). `angle` tilts the floor between 30 and 85 degrees (default 68); higher is flatter. `cellSize` sets the grid square at the front edge.

### Can I stop the grid from moving but keep the look?

Yes: `speed={0}` removes the animation. The animation also pauses when the panel is more than 80px off screen.

## Rules for generating code

- Use semantic tokens only (bg, surface, sunken, border, fg, fg-muted, fg-subtle, ink, accent, success, warning, danger). Never raw hex or palette steps like blue-500.
- Shadows only from the set: shadow-xs, shadow-sm, shadow-raised, shadow-md, shadow-lg, shadow-overlay.
- Numbers use tabular-nums. Dark mode is the `dark` class on <html>; components never branch on theme.

## Dependencies

- npm: `lucide-react`, `motion`
- Built from: [button](https://ui.minidev.pro/docs/button/md)

## Related

- [Dot Pattern](https://ui.minidev.pro/docs/dot-pattern/md): A dot or grid background drawn as one SVG pattern, faded at the edges, with an optional accent glow that follows the pointer and lights the dots beneath it.
- [Background Boxes](https://ui.minidev.pro/docs/background-boxes/md): React background of skewed hairline boxes: the box under the pointer lights up in colour and fades out, driven by one pointer handler and CSS transitions.
- [Lamp Effect](https://ui.minidev.pro/docs/lamp-effect/md): A React lamp effect for dark hero panels: a thin bright line at the top switches on and widens, casting a soft cone of light on the headline beneath it.
- [Meteors](https://ui.minidev.pro/docs/meteors/md): React meteors background that sends accent colored streaks with fading tails falling diagonally behind your content, with count, angle and speed props.
- [Animated Feature Row](https://ui.minidev.pro/docs/animated-feature-row/md): A row of feature cards that slide up with a staggered delay when scrolled into view. Pass title and description pairs; reduced motion keeps them still.
- [Card Tilt](https://ui.minidev.pro/docs/card-tilt/md): A card that tilts in 3D toward the pointer on springs, with an accent glare that follows the cursor. It stays flat when reduced motion is preferred.

---

All 557 components: https://ui.minidev.pro/llms.txt (full text: https://ui.minidev.pro/llms-full.txt).
