Dot Field - React Component | Kokonut UI
Dot Field
A halftone dot membrane that ripples behind a swipe and rings out from a click, built with React and Canvas.
Install with Agentbunn npm
npx shadcn@latest add https://kokonutui.com/r/dot-field.json
Leave a mark
A halftone membrane. Swipe fast to leave a wake, click to send a shockwave through it.
Installation
Dot Field is a free, open-source React component in the Kokonut UI Backgrounds collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/dot-field.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/dot-field
Usage
import DotField from "@/components/kokonutui/dot-field";
export default function Example() {
return <DotField />;
}
Props
className
string
Extra classes for the root element.
children
ReactNode
Content shown over the field. Pass null for a bare background.
spacing
number
Default 16
Distance between dots, in px.
interactive
boolean
Default true
Let a swipe push the dots and a click send a shockwave.
seed
number
Default 7
Seed for the halftone pattern, so a page always opens on the same one.
Dependencies
| Needs | Version | Comes from |
|---|---|---|
cn from lib/utils.ts |
shadcn init | |
| React | 19 |
Your app |
| Tailwind CSS | 4 |
Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.