A true 3D floor of glowing lines that recedes forever to a lit horizon, with an optional ceiling for a tunnel.
A retro perspective grid rolling toward a glowing horizon, synthwave style.
Customize
Usage
import { HorizonGrid } from "@/components/motionkit/horizon-grid";
<HorizonGrid className="h-96 rounded-3xl pt-20 text-center">
<h1>Your hero</h1>
</HorizonGrid>Motion
The exact curves this component runs, plotted with Motion's own maths.
Roll forward
Runs on its own
Retro, synthwave, gaming and music themes, launch pages and event sites.
A grid of lines is painted with CSS gradients on a floor that tips away under a CSS perspective. Moving the background-position by exactly one square loops it seamlessly, so the grid rolls towards you forever. The far edge fades into a glowing horizon line.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/horizon-grid.jsonnpm install motionSave as components/motionkit/horizon-grid.tsx.
"use client";
import type { ReactNode } from "react";
import { motion, useReducedMotion } from "motion/react";
type HorizonGridProps = {
children?: ReactNode;
/** Grid square size in pixels. */
cell?: number;
/** Tilt of the floor in degrees. Higher looks flatter. */
angle?: number;
/** Seconds for the grid to travel one square toward the viewer. */
duration?: number;
/** Line and horizon colour. */
color?: string;
className?: string;
};
export function HorizonGrid({
children,
cell = 40,
angle = 70,
duration = 1.2,
color = "#2E9098",
className = "",
}: HorizonGridProps) {
const reduceMotion = useReducedMotion();
return (
<div className={`relative isolate overflow-hidden bg-[#0C1010] ${className}`}>
<div aria-hidden className="absolute inset-x-0 bottom-0 -z-10 h-[45%] overflow-hidden [perspective-origin:50%_0%] [perspective:200px]">
{/* the floor hinges on the bottom edge and tips away; moving the pattern by exactly one square loops seamlessly */}
<motion.div
className="absolute -inset-x-full bottom-0 h-[400%]"
style={{
rotateX: angle,
originY: 1,
backgroundImage: `linear-gradient(to right, ${color} 1px, transparent 1px), linear-gradient(to bottom, ${color} 1px, transparent 1px)`,
backgroundSize: `${cell}px ${cell}px`,
opacity: 0.55,
}}
animate={reduceMotion ? undefined : { backgroundPosition: ["0px 0px", `0px ${cell}px`] }}
transition={{ duration, repeat: Infinity, ease: "linear" }}
/>
{/* fade the far edge into the horizon */}
<div className="absolute inset-0 bg-[linear-gradient(to_bottom,#0C1010,transparent_60%)]" />
</div>
{/* the horizon line and its glow */}
<div
aria-hidden
className="absolute inset-x-0 top-[55%] -z-10 h-px"
style={{ background: `linear-gradient(to right, transparent, ${color}, transparent)`, boxShadow: `0 0 40px 6px ${color}55` }}
/>
{children}
</div>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| cell | number | 40 | Grid square size in pixels. |
| angle | number | 70 | Tilt of the floor in degrees. Higher looks flatter. |
| duration | number | 1.2 | Seconds for the grid to travel one square toward the viewer. |
| color | string | "#2E9098" | Line and horizon colour. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Only the motion package, beside React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/horizon-grid.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
The grid holds still for reduced-motion users. It loops forever otherwise, so if it sits beside other content for more than 5 seconds, WCAG 2.2.2 asks you to add a pause control.
A true 3D floor of glowing lines that recedes forever to a lit horizon, with an optional ceiling for a tunnel.
A sea of dots on a 3D plane rolling in slow waves to the horizon, swelling up around the cursor.
A glossy pearl of slowly swirling colour that breathes, catches the light and leans towards the cursor. A calm centrepiece for a hero.
Into the future