Retro Grid
MotionReact retro grid background: a perspective floor receding to a glowing horizon that scrolls slowly toward the viewer, with angle and cell size props.
Installation
npx shadcn@latest add @minidev/retro-grid
MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/retro-grid.json
Usage
import { RetroGrid } from "@/components/ui/retro-grid"
export function Example() {
return (
<RetroGrid />
)
}
API reference
| Prop | Type | Default |
|---|---|---|
| angleTilt of the floor in degrees. Higher is flatter and longer. | number | 68 |
| cellSizeSize of one grid cell in pixels, at the front of the floor. | number | 48 |
| speedCells per second travelled toward the viewer. | number | 0.7 |
| horizonWhere the floor meets the sky, as a percent of the height from the top. | number | 56 |
| className | string | - |
| children | React.ReactNode | - |
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.
Accessibility
- The whole floor is
aria-hiddenandpointer-events-none. - Under reduced motion the floor is drawn but does not scroll.
Frequently asked questions
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.
Dependencies
npm
Built from
Examples
Flatter and faster
A higher angle lays the floor flatter and longer; cellSize widens the squares and speed is cells per second.
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.
Hero with two actions
Children replace the sample content; a steeper angle keeps the floor short under a taller hero.