Dot Pattern
A background dot pattern made with SVGs, fully customizable using Tailwind CSS.
Dot Pattern Background
A beautiful dot pattern for your backgrounds
Installation
Dependencies
Examples
Gradient
Radial Gradient Mask
Dots fade out in a radial gradient with glow effect
import { DotPattern } from "@/components/vritti/dot-pattern";
export function DotPatternGradientExample() {
return (
<div className="relative flex h-[500px] w-full items-center justify-center overflow-hidden rounded-lg border bg-background">
<DotPattern
className="[mask-image:radial-gradient(300px_circle_at_center,white,transparent)]"
glow
/>
<div className="z-10 text-center">
<h1 className="text-4xl font-bold">Radial Gradient Mask</h1>
<p className="text-muted-foreground mt-2">
Dots fade out in a radial gradient with glow effect
</p>
</div>
</div>
);
}
Linear
Linear Gradient Mask
Larger dots with a top-to-bottom fade
import { DotPattern } from "@/components/vritti/dot-pattern";
export function DotPatternLinearExample() {
return (
<div className="relative flex h-[500px] w-full items-center justify-center overflow-hidden rounded-lg border bg-background">
<DotPattern
width={24}
height={24}
cr={1.5}
className="[mask-image:linear-gradient(to_bottom,white,transparent)] text-blue-400 dark:text-blue-600"
/>
<div className="z-10 text-center">
<h1 className="text-4xl font-bold">Linear Gradient Mask</h1>
<p className="text-muted-foreground mt-2">
Larger dots with a top-to-bottom fade
</p>
</div>
</div>
);
}
Props
Dot Pattern
| Prop | Type | Default | Description |
|---|---|---|---|
width | number | 16 | Horizontal spacing between dots in pixels |
height | number | 16 | Vertical spacing between dots in pixels |
cr | number | 1 | Radius of each dot |
glow | boolean | - | Whether dots should have a glowing animation effect |