OPUS/UI

Navigation

Dot Grid

hot

A matrix of spring-loaded dots that bulge away from (or toward) the pointer and wobble back into place. Clicking sends a shockwave rolling through the grid.

canvasspringspointerclick5 files · 414 locdeps: clsx, tailwind-merge

Installation

With the shadcn CLI, pointing at this platform’s registry:

npx shadcn@latest add https://opusui.131199999.xyz/r/dot-grid.json

Or offline, straight from your opus55 checkout (copies every file it needs):

node ../tailwind_component/opus55/scripts/add.mjs dot-grid

Usage

import { DotGrid } from "@/components/opus/backgrounds/dot-grid";

<DotGrid className="absolute inset-0" />

API

PropTypeDefaultDescription
color / activeColorstring—Resting and excited dot colours.
gap / sizenumber26 / 1.6Grid pitch and dot radius (px).
radiusnumber140Pointer influence radius (px).
mode"push" | "pull""push"Direction of the pointer force.
stiffnessnumber0.08Spring stiffness — lower is jelly.
shockwavebooleantrueClick sends a ring through the grid.
interactivebooleantrueReact to the pointer (tracked on window).
classNamestring—Wrapper classes — `absolute inset-0` to fill a relative parent.
childrenReactNode—Optional content rendered above the canvas.

Notes

  • Canvas 2D with a device-pixel-ratio aware backing store (capped at 2×).
  • The animation loop stops off-screen and in hidden tabs; resize re-seeds the scene.
  • prefers-reduced-motion: reduce draws a single static frame.

Command palette