Glin UI
Background / CanvasAdapted from Magic UIbeta

Flickering Grid

Canvas grid of squares that flicker, with token colors and a static fallback.

Edit on GitHub
Status

Know about the outage before your users do

Probe from 14 regions every 30 seconds, route alerts to the right on-call and publish incidents to a status page.

Works with

  • Vercel
  • GitHub
  • Cloudflare
  • Astro

Installation

Install from
pnpm dlx @glinui/cli@latest add flickering-grid

Credits. Adapted from Magic UI (MIT, (c) Magic UI). Token colors resolved at runtime, device pixel ratio transform, frame rate cap, pause offscreen and hidden, static frame for reduced motion. Attribution details.

Prefer the package?

Usage

The grid fills its parent (size-full), so give the parent a size. Keep maxOpacity at 0.3 or lower behind text. The loop costs battery, so avoid stacking several grids on one page.

Variants

Square and round cells, and a busier field with a higher flicker chance.

Square
Round
Busy
import { FlickeringGrid } from "@glinui/ui"
export function Variants() {
return (
<div data-glin-theme="dark" className="grid w-full gap-3 sm:grid-cols-3">
<div className="relative isolate flex h-44 items-end overflow-hidden rounded-xl bg-[var(--surface-0)] p-3">
<FlickeringGrid squareSize={4} gridGap={6} maxOpacity={0.4} className="absolute inset-0" />
<span className="relative z-10 rounded-full bg-black/70 px-2.5 py-1 text-xs font-medium text-white">Square</span>
</div>
<div className="relative isolate flex h-44 items-end overflow-hidden rounded-xl bg-[var(--surface-0)] p-3">
<FlickeringGrid variant="round" squareSize={4} gridGap={8} maxOpacity={0.4} className="absolute inset-0" />
<span className="relative z-10 rounded-full bg-black/70 px-2.5 py-1 text-xs font-medium text-white">Round</span>
</div>
<div className="relative isolate flex h-44 items-end overflow-hidden rounded-xl bg-[var(--surface-0)] p-3">
<FlickeringGrid squareSize={3} gridGap={5} flickerChance={0.6} maxOpacity={0.4} className="absolute inset-0" />
<span className="relative z-10 rounded-full bg-black/70 px-2.5 py-1 text-xs font-medium text-white">Busy</span>
</div>
</div>
)
}

Behind a dashboard header

A quiet flicker behind live metrics suggests activity without distracting from numbers.

Production, last 24 hours

API overview

Requests
2.41M
+8.2% vs yesterday
p95 latency
184 ms
-12 ms vs yesterday
Error rate
0.03%
-0.01% vs yesterday
import { FlickeringGrid, Button, Heading, Text } from "@glinui/ui"
const stats = [
["Requests", "2.41M", "+8.2%"],
["p95 latency", "184 ms", "-12 ms"],
["Error rate", "0.03%", "-0.01%"]
]
export function UsageHeader() {
return (
<section data-glin-theme="dark" className="relative isolate flex min-h-[22rem] w-full flex-col justify-end gap-6 overflow-hidden rounded-xl bg-[var(--surface-0)] p-6 sm:p-8">
<FlickeringGrid squareSize={4} gridGap={6} maxOpacity={0.35} className="absolute inset-0" />
<div className="relative z-10 flex flex-wrap items-end justify-between gap-4">
<div className="flex flex-col gap-1">
<Text variant="eyebrow">Production, last 24 hours</Text>
<Heading level={2} size="md">API overview</Heading>
</div>
<div className="flex gap-2">
<Button size="sm" variant="outline">Export CSV</Button>
<Button size="sm">Create alert</Button>
</div>
</div>
<dl className="relative z-10 grid gap-3 sm:grid-cols-3">
{stats.map(([label, value, delta]) => (
<div key={label} className="rounded-xl border border-[var(--line-soft)] bg-[var(--surface-1)] p-4">
<dt className="text-xs text-[var(--color-muted)]">{label}</dt>
<dd className="mt-1 text-2xl font-semibold tabular-nums text-[var(--color-foreground)]">{value}</dd>
<dd className="text-xs text-[var(--tone-success-text)]">{delta} vs yesterday</dd>
</div>
))}
</dl>
</section>
)
}

Accessibility

  • Decorative canvas: aria-hidden, pointer-events none.
  • Flicker is low contrast and slow. Keep maxOpacity at 0.3 or lower; it never flashes more than three times per second per cell on average at default settings.
  • Content on top should still meet AA contrast.

ARIA Attributes

  • `aria-hidden="true"` on the wrapper

Reduced Motion

At motion level full squares flicker through requestAnimationFrame. With prefers-reduced-motion or level none or subtle the grid draws a single static frame. The loop pauses offscreen and when the tab is hidden.

Affected properties

canvas redraw

API Reference

PropTypeRequiredDefaultDescription
squareSizenumberNo4Square edge in px.
gridGapnumberNo6Gap between squares in px.
flickerChancenumberNo0.3Chance per second that a square re-rolls.
colorstringNovar(--color-foreground)Any CSS color or token.
maxOpacitynumberNo0.3Highest square opacity.
maxFpsnumberNo30Frame cap.
variant"square" | "round"NosquareCell shape.
seednumberNo7Seed for the starting pattern.

Source

Import directly from the package or browse the source on GitHub. Click any file to view it.

Import

import { FlickeringGrid } from "@glinui/ui"

Dependencies

@glinui/ui@glinui/motion

Generated API Snapshot

Beta

Auto-extracted from TypeScript source in packages/ui/src/components/flickering-grid.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.

Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata

Primary Props Type

FlickeringGridProps

FlickeringGridProps

PropTypeRequiredDefaultDescription
colorstringNo"var(--color-foreground)"Any CSS color, including var(), oklch() and color-mix(). Defaults to the foreground token.
flickerChancenumberNo0.3Chance per second that a square re-rolls its opacity.
gridGapnumberNo6Gap between squares in px.
maxFpsnumberNo30Frame cap for the flicker loop.
maxOpacitynumberNo0.3Highest opacity a square can reach. Keep at or below 0.3 behind text.
seednumberNo7Seed for the deterministic starting pattern.
squareSizenumberNo4Square edge in px.
variant"square" | "round"No"square"-