Getting Started
Blocks
Components
Device Mocks
Special Effects
Animations
Text Animations
Buttons
"use client";
import { cn } from "@/lib/utils";
import { DotPattern } from "@/registry/magicui/dot-pattern";
export function DotPatternDemo() {
return (
<div className="relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border bg-background">
<DotPattern
className={cn(
"[mask-image:radial-gradient(300px_circle_at_center,white,transparent)]",
)}
/>
</div>
);
}
Installation
pnpm dlx shadcn@latest add @magicui/dot-pattern
Examples
Linear Gradient
"use client";
import { cn } from "@/lib/utils";
import { DotPattern } from "@/registry/magicui/dot-pattern";
export function DotPatternLinearGradient() {
return (
<div className="relative flex size-full items-center justify-center overflow-hidden rounded-lg border bg-background p-20">
<DotPattern
width={20}
height={20}
cx={1}
cy={1}
cr={1}
className={cn(
"[mask-image:linear-gradient(to_bottom_right,white,transparent,transparent)] ",
)}
/>
</div>
);
}
With Glow Effect
"use client";
import { cn } from "@/lib/utils";
import { DotPattern } from "@/registry/magicui/dot-pattern";
export function DotPatternWithGlowEffectDemo() {
return (
<div className="relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden">
<DotPattern
glow={true}
className={cn(
"[mask-image:radial-gradient(300px_circle_at_center,white,transparent)]",
)}
/>
</div>
);
}
Usage
import { DotPattern } from "@/components/magicui/dot-pattern";
<div className="relative h-[500px] w-full overflow-hidden">
<DotPattern />
</div>
Props
Dot Pattern
Prop | Type | Default | Description |
---|---|---|---|
width | any | 16 | Width of the dot pattern |
height | any | 16 | Height of the dot pattern |
x | any | 0 | X position of the dot |
y | any | 0 | Y position of the dot |
cx | any | 1 | X position of the circle |
cy | any | 1 | Y position of the circle |
cr | any | 1 | Radius of the circle |
className | string | - | Class name of the dot pattern |
glow | boolean | false | Activates the glow effect in the dot pattern |
Limited Time Offer
Ship Faster with Magic UI ProMagic UI Pro
Stop building from scratch.
Get 8 production-ready templates and 50+ premium components that your users will love.
✓
Next.js 15 + TypeScript ready✓
Copy, paste, customize in minutes✓
Save 100+ hours of development