Components

Retro Grid

An animated synthwave retro grid background for React and Tailwind CSS: a faint perspective floor that scrolls toward the viewer and vanishes into a soft horizon, with an optional striped setting sun. Pure CSS gradients and one 3D transform, with no canvas and no per-frame JavaScript.

  • Background
  • Synthwave
  • CSS 3D transform
  • Striped sun
  • Pauses off-screen
  • Reduced-motion safe

Game jam 2026

48 hours, one theme, any engine. Teams of up to four.

Installation

$ npx shadcn@latest add https://duskui.com/r/retro-grid.json

The grid fills its nearest positioned parent, so give the parent relative and overflow-hidden, and put your content after it with relative so it sits on top.

Usage

hero.tsx
import { RetroGrid } from "@/components/dusk/retro-grid/retro-grid"

export function Hero() {
  return (
    <section className="relative h-[480px] overflow-hidden">
      <RetroGrid />
      <div className="relative">{/* your content */}</div>
    </section>
  )
}

Examples

With a sun

Turn on sun for the striped sun, set color for the grid and sunColors for the top and bottom of the sun. horizon moves the horizon line.

Night drive

Angle, cells & horizon

angle is the tilt of the floor: low angles look down on the grid, high angles skim across it. The perspective is solved for each angle, so the floor always vanishes exactly on the horizon.

angle={40} horizon={0.35}
angle={72} cellSize={36}

API Reference

Any other div prop is passed to the root. Only the floor moves, with a Web Animations API transform, so it runs on the compositor.

PropTypeDefaultDescription
anglenumber65Tilt of the floor in degrees, clamped to 20–75.
cellSizenumber56Tile size in px at the bottom edge.
colorstring"rgb(255 255 255)"Grid line and horizon color. Any CSS color.
speednumber1Scroll speed multiplier; 0 holds the floor still.
sunbooleanfalseShow the striped sun on the horizon.
sunColors[string, string]shades of colorTop and bottom colors of the sun gradient.
horizonnumber0.5Horizon height as a fraction of the container from the top, 0.2–0.8.
lineWidthnumber1Grid line thickness in px.
classNamestring—Merged onto the absolutely positioned root.

Accessibility

  • The grid is decorative: it is aria-hidden and pointer-events-none, so it never reaches screen readers or blocks clicks.
  • With prefers-reduced-motion the floor holds still; the scene looks the same, it just doesn't scroll.
  • Scrolling pauses while the grid is off-screen or the tab is hidden.
  • The horizon is bright; keep text above it or below on the darker floor rather than on the horizon line.