Dot Pattern
interlace-ui/dot-patternFreeComponent
A resolution-independent dotted-grid background that fills its positioned container. Two render modes share one tiled SVG `<pattern>`:
Install it
npx shadcn@latest add https://ds.interlace.tools/r/dot-pattern.jsonSource
1"use client";23import {4 type ComponentPropsWithoutRef,5 forwardRef,6 useEffect,7 useId,8 useImperativeHandle,9 useRef,10 useState,11} from "react";1213// @interlace/dot-pattern v1.1.0 — Interlace design system.14// Docs, props and live preview: https://ds.interlace.tools/c/dot-pattern15// What changed since: https://ds.interlace.tools/c/dot-pattern#history16// Generated banner — keep it, the upgrade diff reads this version.1718/**19 * @interlace/ui — DotPattern (decorative background pattern)20 *21 * A resolution-independent dotted-grid background that fills its positioned22 * container. Two render modes share one tiled SVG `<pattern>`:23 *24 * - **static** (default): a single tiled `<rect>` paints the whole grid as25 * one GPU-cheap fill — O(1) DOM nodes regardless of container size.26 * - **glow**: a radial-gradient dot is animated per-cell. We still bound the27 * work — glow renders individual `<circle>`s only for the measured tile28 * count, gated entirely behind `prefers-reduced-motion`.29 *30 * | Rule | Concept | Where in this file |31 * | ---- | -------------------------------- | ------------------------------------------------------------------------ |32 * | R2 | Travels (high) | Pure decoration, zero product nouns — any site can drop it behind a hero |33 * | R4 | Extends native el + JSDoc | `ComponentPropsWithoutRef<"svg">`; `@default` on every public prop |34 * | R5 | `data-testid` typed, no default | `"data-testid"?: string` — consumer supplies |35 * | R6 | `data-slot` on the root | `data-slot="dot-pattern"` |36 * | R7 | className merged + ...rest + ref | `cn(...)` + `{...props}` + forwarded `ref` |37 * | R8 | Booleans default-false, no `is` | `glow = false` |38 * | R18 | Tailwind only | No inline static styles; SVG geometry uses numeric attrs |39 * | R19 | Tokens only | `currentColor` + the `color` prop; no raw hex / rgb / oklch |40 * | R23 | CLS=0 | `absolute inset-0` decorative chrome; no async height |41 * | R25 | `"use client"` only as needed | Required — `useId` + motion + reduced-motion hook |42// … truncated
More from interlace-ui
All 140 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| A11y Startera11y-starter | interlace-ui | Components | Free | no deps | |
| Accordionaccordion | interlace-ui | Components | Free | no deps | |
| Alertalert | interlace-ui | Components | Free | no deps | |
| Alert Dialogalert-dialog | interlace-ui | Components | Free | no deps | |
| Animated Gradient Textanimated-gradient-text | interlace-ui | Components | Free | no deps | |
| Animated Grid Patternanimated-grid-pattern | interlace-ui | Components | Free | no deps | |
| Animated Listanimated-list | interlace-ui | Components | Free | no deps | |
| Article Cardarticle-card | interlace-ui | Components | Free | no deps |
