A perspective floor grid that scrolls slowly toward the viewer, drawn with CSS only.
Optional, and kept apart.
Nothing here is included in a project unless you add it, and the plain component it builds on is unchanged. This effect is decoration: it is hidden from screen readers, stands still for visitors who prefer reduced motion, and can be paused. Use Still on a preview to see that version.
Perspective floor
Scrolls toward you slowly
import { RetroGrid } from "@rdloom/react";
export default function RetroGridBasic() {
return (
<div className="flex w-full justify-center">
<div className="relative flex h-96 w-full items-center justify-center overflow-hidden rounded-xl border border-[var(--rd-color-border-default)] bg-[var(--rd-color-surface-default)]">
<RetroGrid />
<div className="relative text-center">
<p className="text-4xl font-semibold tracking-tight text-[var(--rd-color-text-default)]">Perspective floor</p>
<p className="text-base text-[var(--rd-color-text-muted)]">Scrolls toward you slowly</p>
</div>
</div>
</div>
);
}Installation
npx rdloom add retro-gridCopies the source into src/components/rdloom. Edit it freely: rdloom upgrade merges later versions into your changes.
It also adds rdloom-motion.css next to your tokens and imports it from the tokens file, once: no setup, and no inline styles. The plain components you already use are untouched.
Use another registry client
npx shadcn@latest add https://rdloom.vimalbhatt.com/r/retro-grid.jsonWorks, but without upgrade tracking, and you import the motion CSS yourself.
Usage
import { RetroGrid } from "@rdloom/react";
<div className="flex w-full justify-center">
<div className="relative flex h-96 w-full items-center justify-center overflow-hidden rounded-xl border border-[var(--rd-color-border-default)] bg-[var(--rd-color-surface-default)]">
<RetroGrid />
<div className="relative text-center">
<p className="text-4xl font-semibold tracking-tight text-[var(--rd-color-text-default)]">Perspective floor</p>
<p className="text-base text-[var(--rd-color-text-muted)]">Scrolls toward you slowly</p>
</div>
</div>
</div>Colored
Ember floor
Steeper and finer
import { RetroGrid } from "@rdloom/react";
export default function RetroGridColored() {
return (
<div className="flex w-full justify-center">
<div className="relative flex h-96 w-full items-center justify-center overflow-hidden rounded-xl border border-[var(--rd-color-border-default)] bg-[var(--rd-color-surface-default)]">
<RetroGrid color="var(--rd-color-ember-500)" angle={70} cellSize={48} />
<div className="relative text-center">
<p className="text-4xl font-semibold tracking-tight text-[var(--rd-color-text-default)]">Ember floor</p>
<p className="text-base text-[var(--rd-color-text-muted)]">Steeper and finer</p>
</div>
</div>
</div>
);
}Still
Held still
The floor stops
import { RetroGrid } from "@rdloom/react";
export default function RetroGridStill() {
return (
<div className="flex w-full justify-center">
<div className="relative flex h-96 w-full items-center justify-center overflow-hidden rounded-xl border border-[var(--rd-color-border-default)] bg-[var(--rd-color-surface-default)]">
<RetroGrid isStill />
<div className="relative text-center">
<p className="text-4xl font-semibold tracking-tight text-[var(--rd-color-text-default)]">Held still</p>
<p className="text-base text-[var(--rd-color-text-muted)]">The floor stops</p>
</div>
</div>
</div>
);
}API Reference
Defined by the spec. Components also accept the props of the React Aria component they wrap.
| Prop | Type | Default |
|---|---|---|
angleTilt of the floor in degrees. | number | 65 |
cellSizeSize of one grid cell in pixels. | number | 60 |
colorColour of the grid lines: any CSS colour or token. | string | "var(--rd-color-border-strong)" |
durationSeconds one cell takes to scroll. | number | 15 |
isStillStops all movement. Moving content should be stoppable. | boolean | false |
Accessibility
Role presentation, WCAG 2.2 AA. Tested with axe and keyboard tests; screen reader checks are in the audit checklist.
Keyboard
Not interactive.
Screen readers announce
- Ignored: it is not announced
What your code must do
- Pure decoration: aria-hidden, never focusable, and pointer-events none so content on top stays usable
- Drawn with CSS only, so it needs no JavaScript and is safe in server HTML
- Stands still for visitors who ask for less motion (prefers-reduced-motion), with isStill, and inside an rdm-still container
- Nothing flashes more than 3 times a second (WCAG 2.3.1) and moving content can be stopped (WCAG 2.2.2)
- Hidden in forced-colors (high contrast) mode so it never fights system colours
- Keep text on top at 4.5:1 against the effect: use a low-contrast colour
Guidelines
Use it when
- The bottom of a hero section
- A calm, technical backdrop
Avoid it when
- Behind long text
- As the only sign of a boundary
Don't
- A fast duration: keep the scroll slow
- Placing it behind dense forms
Design tokens
The semantic tokens this component uses. Change them once and every component follows; see Design tokens.
--rd-color-border-strong