Swirski UI

Backgrounds

DotGrid

A configurable dot-grid background for subtle texture, halftone fields and pop-art surfaces.

Component

36

Request Changes

Import

import { DotGrid } from "@swirski/ui";

Playground

6 controls

Controls

0.38
14
1.8
5

Usage

<div className="relative h-72 overflow-hidden border-4 border-black bg-[#FFD400]">
  <DotGrid
    className="inset-0"
    color="#0B0B0C"
    opacity={0.38}
    spacing={14}
    dotSize={1.8}
    accentColor="#FF3131"
    accentEvery={5}
    accentDotSize={5}
  />
</div>

Props

10 generated
PropTypeDefaultNotes
accentColorstring-Optional color for larger accent dots.
accentDotSizestring | number3Accent dot radius.
accentEverynumber-Adds an accent dot every N grid cells when greater than 1.
colorstring"currentColor"Primary dot color.
dotSizestring | number1.2Primary dot radius.
opacityCSSProperties['Opacity']-Opacity applied to the grid layer.
size'sm' | 'md' | 'lg'"md"Generated from DotGridProps.
spacingstring | number13Distance between dots.
tone'default'"default"Generated from DotGridProps.
variant'default' | 'accent'"default"Generated from DotGridProps.
...divPropsOmit<HTMLAttributes<HTMLDivElement>, "color">-Forwarded to the root div.
Previous: DrawerNext: LineGrid