Flickering Grid
ProNewA canvas of small squares that flicker at random, like a wall of status LEDs.
Installation
pnpm dlx shadcn@latest add @viewport/flickering-grid
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| size | numberSide of each square in pixels. | 4 |
| gap | numberSpace between squares in pixels. | 6 |
| flicker | numberChance, per square per second, of changing brightness. | 0.3 |
| maxOpacity | numberBrightest a square can get, from 0 to 1. | 0.35 |
| color | stringSquare color. Defaults to the current text color. | — |
| className | string | — |
Accessibility
- Canvas is aria-hidden.
- Holds still under reduced motion and pauses off screen.
- Follows the theme color and redraws only the squares that change.