Skip to content
GitHub

Glyph Matrix

An animated grid of subtly shifting glyphs on a canvas

"use client";
import { GlyphMatrix } from "@/components/backgrounds/pxl/glyph-matrix";
export default function GlyphMatrixDemo() {
return (
<GlyphMatrix />
);
}
pnpm dlx shadcn@latest add pxl-ui/registry/backgrounds/glyph-matrix
import { GlyphMatrix } from "@/components/backgrounds/pxl/glyph-matrix"
<GlyphMatrix />

Use the size prop to change the size of the glyphs.

"use client";
import { GlyphMatrix } from "@/components/backgrounds/pxl/glyph-matrix";
export default function GlyphMatrixSizes() {
return (
<GlyphMatrix
size="lg" />
);
}

Use the variant prop to change the colors of the matrix.

"use client";
import { GlyphMatrix } from "@/components/backgrounds/pxl/glyph-matrix";
export default function GlyphMatrixVariants() {
return (
<div className="flex flex-wrap size-full items-center justify-center gap-2">
<div className="relative w-max h-32 aspect-video pixel-rounded pixel-size-lg">
<GlyphMatrix
glyphs="muted"
variant="muted"
/>
</div>
<div className="relative w-max h-32 aspect-video pixel-rounded pixel-size-lg">
<GlyphMatrix
glyphs="primary"
variant="primary"
/>
</div>
<div className="relative w-max h-32 aspect-video pixel-rounded pixel-size-lg">
<GlyphMatrix
glyphs="info"
variant="info"
/>
</div>
<div className="relative w-max h-32 aspect-video pixel-rounded pixel-size-lg">
<GlyphMatrix
glyphs="success"
variant="success"
/>
</div>
<div className="relative w-max h-32 aspect-video pixel-rounded pixel-size-lg">
<GlyphMatrix
glyphs="warning"
variant="warning"
/>
</div>
<div className="relative w-max h-32 aspect-video pixel-rounded pixel-size-lg">
<GlyphMatrix
glyphs="danger"
variant="danger"
/>
</div>
</div>
);
}
Prop Type Default Description
glyphs string "01·•+*/\\<>=" Characters to randomly pick from.
size "default" | "4xs" | "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" "default" Size of the glyphs
variant "default" | "primary" | "secondary" | "muted" | "success" | "warning" | "danger" "default" Colors of the grids
font "default" | "mono" | "heading" | "sans" Font family of the glyphs
mutationRate number 0.04 Probability a cell mutates each tick.
interval number 90 Tick interval in milliseconds.
className string - Classes applied to the canvas element.
fadeBottom number 0.6 Fade strength toward the bottom of the grid.