Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Astro Dot Pattern with Glow

A dot background that reveals a colored glow under the pointer.

Move the pointer

Installation

bunx --bun shadcn@latest add @gnostic/dot-pattern-with-glow

Usage

The component is the positioned container. Move the pointer over it to show the glow. The slot renders inside that container, under the dot layers.

The pointer effect comes from Hover Glow. This component adds the base dots and a mask, so the color shows only inside each dot.

import { DotPatternWithGlow } from "@/components/patterns/dot-pattern-with-glow"
<DotPatternWithGlow class="h-72">
  <p>Move the pointer</p>
</DotPatternWithGlow>

The glow color defaults to a 40 percent mix of var(--color-primary). Pass var(--color-primary) when the glow should be stronger:

<DotPatternWithGlow class="h-72" glowColor="var(--color-primary)" />

The glow fades out when the pointer leaves the container or the window loses focus.

Examples

Larger glow

glowSize sets the glow radius. maskDotSize sets the radius of each glowing dot. dotLayerProps sets the base dots and keeps the mask on the same grid.

Larger glow

API Reference

DotPatternWithGlowProps

PropType
glowColor?string

CSS color of the glow. Use the color's alpha value to set the glow opacity. The default keeps the glow soft.

Typestring
Default"color-mix(in oklch, var(--primary) 72%, transparent)"
glowSize?number

Radius of the glow, in pixels.

Typenumber
Default96
maskDotSize?number

Radius of each dot in the glow mask, in pixels.

Typenumber
Default1.25
dotLayerProps?DotLayerProps

Props for the base dot layer.

TypeDotLayerProps

See the registry source for the component source.