Skip to content
VenusUI
Get started

Dot Pattern

A repeating dot grid background, with an optional fade toward the edges.

Preview

Installation

npx shadcn@latest add @venusui/dot-pattern

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/dot-pattern.tsx

Usage

The code behind the preview above.

dot-pattern-demo.tsx

import { DotPattern } from "@/components/ui/dot-pattern"

export default function DotPatternDemo() {
  return (
    <div className="relative flex h-56 w-full max-w-lg items-center justify-center overflow-hidden rounded-xl border bg-background">
      <DotPattern fade />
      <p className="relative text-lg font-medium">Dot pattern</p>
    </div>
  )
}

API reference

PropTypeDefaultDescription
spacingnumber16Distance between dots, in pixels.
radiusnumber1Dot radius, in pixels.
fadebooleanfalseFade the dots out toward the edges with a radial mask.

All <svg> props, including className and style.

Requirements

  • Tailwind CSS v4, with a cn helper at @/lib/utils. Works in Server Components.

Customization

  • Dots use currentColor. Change the color with a text class, e.g. className="text-primary/20".
  • It fills the nearest positioned parent. Give that parent relative and overflow-hidden, and put your content after the pattern with relative.

Accessibility

  • Decorative: aria-hidden and ignores the pointer.

Troubleshooting

The pattern covers the whole page.
The parent needs position: relative; otherwise the pattern fills the nearest positioned ancestor.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A dotted 3D Earth with glowing routes between cities; pulses travel each arc and ripple where they land.

Loading preview

Soft, blurred color fields that drift slowly behind content.

Loading preview

Background Beams

Backgrounds

Curved lines across a section with light traveling along them.