Updated
Dot Grid
Customize
Colors
Dot color
Background
circle
grid
Spacing20px
Size2.5px
Intensity0.70
Twinkle0.50
Glow0.60
Ambient0.50
Fade1.00
Speed1.0
Grain0.000
Radius160px
Follow0.60
Trail0.60
Magnify0.50
Installation
npx shadcn@latest add https://uibrik.com/r/dot-grid.jsonAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/dot-grid/dot-grid.tsx"use client"; import { hexToOklab, ShaderSurface, type ShaderBackgroundProps } from "../_shader-background/ShaderSurface"; // A grid of dots with light moving through it: a slow wave of colour, the odd dot twinkling, rings // that spread from a click, and a soft light that glides after the pointer. That light lerps behind // the cursor with a lazier tail (a gentle comet while moving, a circle at rest), and the grid bulges // under it like a loupe. Lit dots grow a little and // cast a faint halo, and a pale wash of the palette drifts underneath so the grid never feels bare. // Dots are drawn per pixel with a one-pixel soft edge, so they stay crisp at any size. const SHADER = /* glsl */ ` uniform float u_spacing; // distance between dots, css px uniform float u_size; // dot diameter, css px uniform float u_radius; // reach of the pointer light, css px uniform float u_intensity; // strength of the drifting wave uniform float u_twinkle; // how often single dots sparkle uniform float u_glow; // halo around lit dots uniform float u_ambient; // colour wash under the grid uniform float u_fade; // fade toward the edges, 0..1 uniform float u_shape; // 0 circle, 1 square, 2 diamond uniform float u_stagger; // 0 grid, 1 every other row shifted half a step uniform vec3 u_dotColor; // resting dot colour, OKLab uniform float u_hasDotColor; // 0: resting dots follow the theme uniform float u_magnify; // loupe strength under the pointer light
Adds the files to
components/uibrik/dot-grid. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/dot-grid.Too large to paste whole, so Copy prompt gives a short prompt that installs it with the CLI. Download the full prompt to attach it instead.
Usage
import { DotGrid } from "@/components/uibrik/dot-grid/dot-grid";<DotGrid colors={["#2fb4d2", "#3a9ef2", "#5a82ea", "#34c1b0"]} dotColor="" background="" shape="circle" pattern="grid" spacing={20} size={2.5} intensity={0.7} twinkle={0.5} glow={0.6} ambient={0.5} fade={1} speed={1} grain={0} animate interactive radius={160} follow={0.6} trail={0.6} magnify={0.5} ripples> …</DotGrid>Where to use Dot Grid
Subtle SaaS heroes
A quiet grid lit by a drifting wave adds texture behind a headline without colour noise.
Docs and product pages
Cursor-lit dots give plain pages a little depth while keeping text easy to read.
Developer tool sites
A grid backdrop fits technical brands that favour structure over decoration.
Pairs with ASCII Field
Props
DotGrid- colors
- Type string[]
- ["#2fb4d2","#3a9ef2","#5a82ea","#34c1b0"]
- Colours the dots light up in, 2 to 6.
- dotColor
- Type string
- ""
- Resting dot colour; empty follows the theme.
- background
- Type string
- ""
- Base colour behind the dots; empty follows the page.
- shape
- Type "circle" | "square" | "diamond"
- "circle"
- Dot shape.
- pattern
- Type "grid" | "stagger"
- "grid"
- "stagger" shifts every other row by half a step.
- spacing
- Type number
- 20
- Distance between dots.
- size
- Type number
- 2.5
- Dot diameter.
- intensity
- Type number
- 0.7
- Strength of the drifting colour wave; 0 leaves only the pointer light.
- twinkle
- Type number
- 0.5
- How often single dots sparkle.
- glow
- Type number
- 0.6
- Soft halo around lit dots.
- ambient
- Type number
- 0.5
- Pale wash of colour drifting under the grid.
- fade
- Type number
- 1
- Fade toward the edges, so the grid has no hard border.
- speed
- Type number
- 1
- Animation speed; 1 is the designed pace.
- grain
- Type number
- 0
- Film grain strength.
- animate
- Type boolean
- true
- Move on its own. Off draws one still frame.
- interactive
- Type boolean
- true
- React to the pointer.
- radius
- Type number
- 160
- How far the pointer light reaches.
- follow
- Type number
- 0.6
- How lazily the light follows the pointer, 0 (locked) to 1 (drifts after it).
- trail
- Type number
- 0.6
- How much the light stretches into a tail while the pointer moves.
- magnify
- Type number
- 0.5
- Loupe strength: how much the dots under the light are enlarged.
- ripples
- Type boolean
- true
- A click sends a ring of light across the grid.
- children
- Type ReactNode
- –
- Content shown on top of the background.
- className
- Type string
- –
- Classes for the box; it fills whatever size you give it.