Dot Grid
A transparent grid of dots for section backgrounds, with an optional slow wave, twinkle, edge fade, and pointer highlight.
Overview
Dot Grid draws an evenly spaced lattice of dots on a transparent canvas, so it sits on any surface. It is the quiet background behind a hero, an empty state, or a feature section. The dots default to currentColor at low opacity, so they follow your text color and switch with the theme.
Optional layers add life without noise:
- Wave swells and shrinks the dots in a slow diagonal pattern.
- Twinkle fades individual dots in and out.
- Pointer highlight grows and recolors the dots near the cursor.
- Fade dissolves the grid toward the edges, the top, or the bottom so it never ends in a hard line.
The grid is centered, so the outer dots sit the same distance from each edge, and it stays crisp at any device pixel ratio.
Installation
Usage
import { DotGrid } from "honestui/shaders"
<section className="relative overflow-hidden rounded-xl border">
<DotGrid className="absolute inset-0" fade="radial" wave={0.3} />
<div className="relative p-12">
<h2>Ship it calmly.</h2>
</div>
</section>Pass content as children or layer it above the grid as in the example. Any CSS color works for color and highlightColor, including custom properties such as var(--primary).
A static grid with no wave, twinkle, or pointer highlight renders once and only redraws on resize, so it costs almost nothing.
Accessibility
The canvas is hidden from assistive technology and the grid is decoration only. Keep dot opacity low behind text and check contrast where the highlight passes under content. The wave and twinkle stop when the user prefers reduced motion, while the element is offscreen, and while the page is hidden. The pointer highlight follows the cursor only and carries no information.