Components
Dot Grid
A dot grid that ripples.
Signal, not noise
<DotGrid>
<Hero />
</DotGrid>Installation
npx shadcn@latest add https://ui.zjkm.tech/r/dot-grid.jsonimport { DotGrid } from "@/components/dot-grid"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
A grid of dots sits behind your content, with ripples rolling out from the centre. It draws on a canvas, and the drawing stops while the grid is off-screen or the tab is hidden.
import { DotGrid } from "@/components/dot-grid";
export function Hero() {
return (
<DotGrid className="rounded-2xl p-16">
<h1>Signal, not noise</h1>
</DotGrid>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | Content shown over the grid. | |
color | string | "#a1a1aa" | Dot colour. |
spacing | number | 22 | Pixels between dots. |
dotSize | number | 1.5 | Dot radius at rest, in pixels. |
speed | number | 0.6 | Ripples per second. |
className | string | Classes for the wrapper. |
With reduced motion, the grid stays still.