ZUI

Search documentation

Find a page or a heading.

Animated Grid Pattern

A decorative grid of lines across its container in which cells fade in and out at random, drawn in the text colour and still under reduced motion.

tsx

Installation

bash

Usage

tsx

The grid fills its nearest positioned ancestor, so place it in a relative box that clips its overflow, and lift the content over it with relative. A mask fades it toward the edges:

tsx

It is decoration: hidden from assistive technology and from the pointer, so nothing it covers stops taking clicks. A text-* class recolours it; the lines draw at 30% of that colour.

API reference

AnimatedGridPattern

Renders an svg and takes every prop an svg takes, plus:

width and height size one cell in px, and x and y shift the grid. Once the grid has measured its box, numSquares cells fade in to maxOpacity over duration seconds, stay lit for repeatDelay seconds, fade out again, and move to another cell at random. Under prefers-reduced-motion the lit cells are drawn still at maxOpacity and never move. It sets data-slot="animated-grid-pattern" and aria-hidden.