Backgrounds

Dot Field

An interactive dot grid that bulges and glows around the cursor.

Adapted from React Bits

Install

# DotField needs no npm packages

Then copy 2 files into your project:

  • components/registry/dot-field/dot-field.tsx
  • hooks/use-animation-loop.ts

Props

PropTypeDefaultDescription
dotRadiusnumber1.5Radius of each dot.
dotSpacingnumber25Spacing between dots.
cursorRadiusnumber500Cursor influence radius.
cursorForcenumber0.1Strength of the cursor push.
bulgeOnlybooleantrueBulge toward the cursor only (no repel).
bulgeStrengthnumber67Bulge displacement strength.
glowRadiusnumber160Radius of the cursor glow.
sparklebooleanfalseAdd a sparkle shimmer.
waveAmplitudenumber0Ambient wave motion.
gradientFromstring (hex)"#a855f7"Dot gradient start.
gradientTostring (hex)"#b497cf"Dot gradient end.
glowColorstring (hex)"#a855f7"Cursor glow color.

What It Demonstrates

Hover effect
Visual change when the cursor moves over an element.
Idle animation
Subtle motion that plays while an element is just sitting there, waiting to be interacted with.
Compositing
Letting the GPU move or fade an element on its own layer without redoing layout or paint.

Related Components

Appears In