Join our Discord Community

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.

Powered by

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:

Loading component...

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:

Loading component...

Glow Effect

Pulsing dots with randomized timing for organic movement:

Loading component...

Custom Configuration

Fine-tuned spacing and sizing for specific design needs:

Loading component...

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.

PropTypeDefaultDescription
widthnumber16Horizontal spacing between dots (pixels)
heightnumber16Vertical spacing between dots (pixels)
xnumber0Pattern X-offset
ynumber0Pattern Y-offset
cxnumber1Individual dot X-offset within cell
cynumber1Individual dot Y-offset within cell
crnumber1Dot radius (pixels)
glowbooleanfalseEnable pulsing glow animation
classNamestring-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:

Questions developers actually ask