Dotted Glow Background

A canvas-based dot grid overlay where soft glows drift across the surface, brightening, enlarging, and tinting nearby dots toward the brand color. It is a decorative, absolutely positioned background for hero sections, cards, and call-to-action areas.

Dotted Glow Background
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @velora/dotted-glow-background

Requires @velora in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { DottedGlowBackground } from "@/components/velora/dotted-glow-background"export function Example() {  return (    <section className="relative overflow-hidden">      <DottedGlowBackground />      <div className="relative z-10 p-12">Content</div>    </section>  )}
  • Adding an animated, premium-feeling backdrop behind a hero section or landing page headline.
  • Highlighting a call-to-action or feature card with a subtle brand-tinted ambient effect.
  • Decorating empty or dashboard panels where a static grid would feel flat but heavy animation would distract.
  • Replacing a plain dotted or grid background with a living texture that still stays behind content.

Examples

Hero section with brand tint

Places the glow grid behind a hero headline. The parent is relative and overflow-hidden so the absolutely positioned canvas stays clipped to the section. The brand color is set through the --brand variable on the section.

hero-section-with-brand-tint.tsx
import { DottedGlowBackground } from "@/components/velora/dotted-glow-background"export function HeroSection() {  return (    <section      className="relative flex min-h-[420px] items-center justify-center overflow-hidden rounded-2xl border text-foreground"      style={{ "--brand": "oklch(0.7 0.19 255)" } as React.CSSProperties}    >      <DottedGlowBackground gap={22} radius={1.4} opacity={0.3} />      <div className="relative z-10 max-w-xl text-center">        <h1 className="text-4xl font-semibold tracking-tight">Build faster with Velora</h1>        <p className="mt-4 text-muted-foreground">Ship polished interfaces in minutes.</p>      </div>    </section>  )}

Call-to-action card with fewer, slower glows

Uses a single calm glow and a slower speed for a restrained effect behind a card. Passing className adds layout classes to the root div, which is merged with the component's base classes.

call-to-action-card-with-fewer,-slower-glows.tsx
import { DottedGlowBackground } from "@/components/velora/dotted-glow-background"export function CtaCard() {  return (    <div className="relative overflow-hidden rounded-xl border bg-card p-8">      <DottedGlowBackground glows={1} speed={0.5} className="opacity-80" />      <div className="relative z-10 flex flex-col items-start gap-4">        <h2 className="text-2xl font-semibold">Start your free trial</h2>        <button type="button" className="rounded-md bg-primary px-4 py-2 text-primary-foreground">          Get started        </button>      </div>    </div>  )}

Panel that keeps animating while hovered

Disables pauseOnHover so the glows keep moving while the pointer is over the parent. Use this when the motion itself is part of the design rather than a passive backdrop.

panel-that-keeps-animating-while-hovered.tsx
import { DottedGlowBackground } from "@/components/velora/dotted-glow-background"export function FeaturePanel() {  return (    <div className="relative h-64 overflow-hidden rounded-lg border">      <DottedGlowBackground pauseOnHover={false} gap={14} radius={1} />      <div className="relative z-10 flex h-full items-center justify-center font-medium">        Hover me      </div>    </div>  )}

API reference

PropTypeDefaultDescription
gapnumber18Distance between dot centres in px. Values below 4 are clamped to 4 internally.
radiusnumber1.2Base dot radius in px. Lit dots grow up to about 1.6 times this value.
opacitynumber0.25Opacity of unlit dots, from 0 to 1. Lit dots fade toward full opacity.
speednumber1Multiplier for how fast the glows travel.
glowsnumber3Number of travelling glows drawn across the grid.
pauseOnHoverbooleantruePauses the animation while the pointer is over the parent element. Focus inside the parent always pauses it regardless of this setting.
classNamestring—Additional classes merged onto the root div via cn(). The root is already absolute inset-0 and pointer-events-none.
...propsReact.HTMLAttributes<HTMLDivElement>—All other standard div attributes are spread onto the root div. The root always has aria-hidden and data-slot="dotted-glow-background".

Accessibility

  • The root element has aria-hidden set, so the decorative canvas is hidden from assistive technologies and screen readers skip it.
  • The component renders no focusable elements and is pointer-events-none, so it does not interfere with keyboard or mouse interaction with content.
  • When the user has prefers-reduced-motion: reduce enabled, the animation does not loop. It draws a single still frame and updates on media query changes.
  • Animation pauses when the element is off screen, the document tab is hidden, or the pointer or focus is inside the parent (with pauseOnHover for pointer). This reduces distraction and power use.
  • Place meaningful text above the background with a relative z-10 wrapper. Unlit dots use the inherited text color at reduced opacity, so verify text contrast against the background.
  • Do not convey essential information through the glow or tint alone, since it is purely decorative.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Dotted Glow Background" component (velora/dotted-glow-background) from its shadcn registry.1. Install it with: npx shadcn@latest add @velora/dotted-glow-background2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: gap, radius, opacity, speed, glows, pauseOnHover, className, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { DottedGlowBackground } from "@/components/velora/dotted-glow-background"export function Example() {  return (    <section className="relative overflow-hidden">      <DottedGlowBackground />      <div className="relative z-10 p-12">Content</div>    </section>  )}```

Files & dependencies

  • src/components/velora/dotted-glow-background.tsx→ components/velora/dotted-glow-background.tsx
registryDependenciesutils

Looks similar, elsewhere