Dot Pattern

A background utility component that renders a repeated dot pattern using SVG `<pattern>`. Useful for decorative backgrounds or UI sections.

dot-pattern-default

dot-pattern-custom

dot-pattern-01

dot-pattern-02

dot-pattern-03

Installation

pnpm dlx shadcn@latest add https://aliimam.in/r/dot-pattern.json

Usage

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

Props

PropTypeDefault
widthnumber20
heightnumber20
xnumber0
ynumber0
cxnumber1
cynumber1
dotSizenumber0.7
classNamestring—
fillstring—
strokestring—
opacitynumber | string—
styleReact.CSSProperties—
idstring—
onClick(event: React.MouseEvent<SVGSVGElement>) => void—
...propsReact.SVGProps<SVGSVGElement>—