Dot Field
ProA canvas dot grid that swells and brightens around the pointer.
Installation
pnpm dlx shadcn@latest add @viewport/dot-field
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| gap | numberDistance between dots in pixels. | 22 |
| radius | numberDot radius in pixels. | 1 |
| reach | numberRadius of the cursor's influence in pixels. | 140 |
| color | stringDot color. Defaults to the current text color. | — |
| className | string | — |
Accessibility
- Canvas is aria-hidden.
- Renders a static grid under reduced motion.
- Pauses when off screen and only animates while the pointer moves.