AstroAnimate Docs — Installation, Components & API

GridDotsBackground NEW

A high-performance, CSS-only background pattern component featuring animated dots or grids.

Preview/Playground

Created by
Creator
Barsan
AstroAstro
---
import GridDotsBackground from "@astroanimate/core/GridDotsBackground";
---

<GridDotsBackground
  variant="dots"
  animate={true}
  mask={true}
  height="400px"
>
  <h1>Welcome to AstroAnimate</h1>
</GridDotsBackground>

Installation

bash
npm install @astroanimate/core

Usage

---
import GridDotsBackground from "@astroanimate/core/GridDotsBackground";
---

<GridDotsBackground variant="dots" animate={true} mask={true} height="400px">
  <div style="position: relative; z-index: 10;">
    <h1>Welcome to AstroAnimate</h1>
  </div>
</GridDotsBackground>

Renders a subtle, ambient background pattern behind nested slot content.

Props

PropTypeDefaultDescription
variant "dots" | "grid" "dots" Visual pattern style
dotColor string "rgba(255,255,255,0.25)" Color of the dots or grid lines
dotSize string "2px" Thickness or diameter of the pattern
gap string "32px" Spacing between dots or grid lines
mask boolean false Apply a radial fade-out mask at the edges
animate boolean false Enable a continuous ambient drifting animation
height string "300px" Height of the background container
bgColor string "#0f0f0f" Base background color
mainClassName string "" Additional CSS classes

Use When

  • Designing modern, tech-focused landing pages and hero sections
  • Needing subtle depth and ambient motion without sacrificing page performance
  • Creating "blueprint" or "space" aesthetics

Avoid When

  • Nesting behind dense, low-contrast text (unless using the mask prop to clear the center)
  • Building complex, multi-colored illustrated backgrounds

Accessibility

  • Fully respects prefers-reduced-motion: reduce by disabling the infinite CSS drift animation

Performance

  • Zero Hydration: Contains absolutely no JavaScript; strictly built with CSS
  • Low DOM Footprint: Achieves the pattern effect using a single DOM element with radial-gradient and linear-gradient, avoiding hundreds of nested SVG nodes

Credits