Skip to Content
zjkm-ui
Components

Dot Grid

A dot grid that ripples.

Signal, not noise

Props
22px
1.5px
0.6
<DotGrid>
  <Hero />
</DotGrid>

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/dot-grid.json
import { 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

PropTypeDefaultDescription
childrenReactNodeContent shown over the grid.
colorstring"#a1a1aa"Dot colour.
spacingnumber22Pixels between dots.
dotSizenumber1.5Dot radius at rest, in pixels.
speednumber0.6Ripples per second.
classNamestringClasses for the wrapper.

With reduced motion, the grid stays still.

On this page