Background
Dot Pattern
Customizable SVG dot patterns with optional glow effects. Perfect for React applications requiring structured backgrounds with Next.js integration and TypeScript support.
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
Features
- SVG-based dot patterns with customizable size, spacing, and positioning parameters
- Optional glow animations featuring randomized timing for natural-looking pulsing effects
- Mask image support enabling creative directional fades and gradient effects
- Responsive scaling with automatic container size detection and pattern adjustment
- Performance optimized using efficient SVG rendering and proper memoization
- TypeScript support with comprehensive prop types for reliable integration
- Motion integration providing smooth animations and transition effects
- Tailwind CSS compatibility allowing easy styling with utility classes and color control
Examples
Linear Gradient Mask
Glow Effect
Custom Configuration
Use Cases
This free open source React component works well for:
- Dashboard backgrounds - Subtle structured patterns for data-heavy interfaces built with Next.js
- Landing page sections - Professional dot patterns that don't compete with content using TypeScript
- Portfolio layouts - Clean geometric backgrounds showcasing work using shadcn/ui design
- Documentation sites - Technical precision patterns for developer resources
- App interfaces - Structured backgrounds that reinforce grid-based layouts using Tailwind CSS
- Presentation templates - Professional patterns for slides and marketing materials
API Reference
DotPattern
Prop | Type | Default | Description |
---|---|---|---|
width | number | 16 | Horizontal spacing between dots |
height | number | 16 | Vertical spacing between dots |
x | number | 0 | X-offset of the entire pattern |
y | number | 0 | Y-offset of the entire pattern |
cx | number | 1 | X-offset of individual dots |
cy | number | 1 | Y-offset of individual dots |
cr | number | 1 | Radius of each dot |
glow | boolean | false | Enable glowing animation effect |
className | string | undefined | Additional CSS classes to apply |
Implementation Notes
- Component automatically detects container size changes and adjusts pattern accordingly
- Glow effect uses randomized animation delays and durations for natural-looking movement
- Dot colors controlled using Tailwind text color utilities (e.g.,
text-blue-500/60
) - Use mask images with Tailwind CSS classes to create directional fade effects
- Optimized for performance with proper memoization and efficient SVG rendering
- Compatible with shadcn/ui design system and all standard SVG props
- Supports creative mask effects like linear gradients and radial patterns
Bubble Background
Animated bubble background with interactive mouse tracking and customizable colors. Perfect for React applications requiring dynamic backgrounds with Next.js integration and TypeScript support.
Etheral Shadow
Animated shadow overlay effects with SVG filters and noise textures. Perfect for React applications requiring atmospheric backgrounds with Next.js integration and TypeScript support.