React Background Dot Pattern
Minimalist dot grids that pulse like a heartbeat monitor. Build elegant React backgrounds with SVG patterns, optional glow effects, TypeScript support, and gradient masking for Next.js applications with shadcn/ui.
Trying to implement dot patterns?
Join our Discord community for help from other developers.
Dots. The most basic visual element, yet somehow the hardest to get right. Too big and they're distracting. Too small and they disappear. This React component nails the balance—clean SVG dots that can glow, fade, or just sit there looking professional.
Minimalist dot grid
Clean, structured patterns that know their place:
Built for React applications with TypeScript and Next.js. Each dot is an SVG circle, so they stay crisp at any resolution. Add the glow prop and watch them pulse with randomized timing, like a field of fireflies that actually respect your CPU.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/dot-pattern.json
npx shadcn@latest add https://www.shadcn.io/registry/dot-pattern.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/dot-pattern.json
bunx shadcn@latest add https://www.shadcn.io/registry/dot-pattern.json
Usage
import { DotPattern } from "@/components/ui/dot-pattern";
export default function Hero() {
return (
<div className="relative h-screen">
<DotPattern
className="absolute inset-0 text-neutral-400/40"
width={20}
height={20}
glow={true}
/>
<div className="relative z-10">
<h1>Your content here</h1>
</div>
</div>
);
}
Why most dot patterns look amateur
Most developers use repeated background images or CSS gradients. The dots look blurry on retina displays, can't be animated, and definitely can't respond to your design system. Some try canvas, but that's overkill for dots.
This React component uses SVG patterns—infinitely scalable, perfectly aligned, and styleable with Tailwind classes. Want glowing dots? Add the glow prop. Want them to fade at the edges? Slap on a mask-image. The dots adapt to their container automatically, no measuring required.
Examples
Linear Gradient Mask
Dots that fade into the distance with gradient masking:
Glow Effect
Pulsing dots with randomized timing for organic movement:
Custom Configuration
Fine-tuned spacing and sizing for specific design needs:
Features
- SVG-based rendering for infinite scalability and crisp dots
- Randomized glow animations creating organic pulsing effects
- Gradient mask support for directional fades and focus areas
- Container-aware sizing automatically adapting to parent dimensions
- TypeScript definitions for all props and configurations
- Tailwind color control using text utilities for dot colors
- Performance optimized with proper memoization
- shadcn/ui compatible following design system patterns
API Reference
DotPattern
Main component for rendering the dot pattern.
Prop | Type | Default | Description |
---|---|---|---|
width | number | 16 | Horizontal spacing between dots (pixels) |
height | number | 16 | Vertical spacing between dots (pixels) |
x | number | 0 | Pattern X-offset |
y | number | 0 | Pattern Y-offset |
cx | number | 1 | Individual dot X-offset within cell |
cy | number | 1 | Individual dot Y-offset within cell |
cr | number | 1 | Dot radius (pixels) |
glow | boolean | false | Enable pulsing glow animation |
className | string | - | Tailwind classes for styling |
Common gotchas
Color opacity matters: Use Tailwind's opacity modifier like text-neutral-400/40
. Without opacity, dots can overwhelm your content.
Container sizing: The pattern fills its container. If dots aren't showing, check that the parent has explicit dimensions.
Glow performance: Each glowing dot has its own animation. Hundreds of glowing dots might lag on weak devices. Use glow sparingly.
Mask browser support: Gradient masks use -webkit-mask-image
. Works everywhere except Internet Explorer (but who cares).
Z-index layering: Dots should be behind content. Use absolute inset-0
on the pattern and relative z-10
on your content.
You might also like
Explore other minimalist background components for React applications:
Grid Pattern
Clean line grids with various styles and animations
Noise
Subtle texture patterns with customizable grain
Interactive Grid Pattern
Grid cells that respond to hover interactions
Hexagon Background
Honeycomb patterns with geometric precision
Squares Background
Floating square elements with smooth animations
Gradient Background
Smooth color transitions for modern interfaces
Questions developers actually ask
React Background Circles
Rotating circles that hypnotize like a mandala in motion. Build mesmerizing React backgrounds with smooth orbital animations, TypeScript support, and eight color themes for Next.js applications with shadcn/ui.
Ethereal Shadow Background
Atmospheric shadows that breathe and distort like fog rolling in. Build cinematic React backgrounds with advanced SVG filters, noise textures, TypeScript support, and smooth distortion effects for Next.js applications with shadcn/ui.