LED Matrix
Dot-matrix marquee with a built-in 5×7 font.
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/led-matrix.jsonUsage
import { LedMatrix } from "@/components/ui/led-matrix"
<LedMatrix text="Next train to Odawara · 3 min" />Examples
Static
speed={0} centers the text. columns fixes the width in dots; rows adds unlit rows around the 7-row font.
Live message
Changing the text restarts the scroll from the edge. direction flips which way it travels.
Dot sizes
Big dots for a sign across the room, small ones for a dense ticker.
API reference
A canvas inside a dark bezel. Renders a <div role="img"> labelled with the text; className styles the bezel.
| Prop | Type | Default |
|---|---|---|
text | stringThe message. A–Z, 0–9 and common punctuation, plus · ° → ← ▲ ▼. Lowercase shows as uppercase; other characters are blank. | None |
speed | numberScroll speed in pixels per second. 0 holds the text still and centers it when it fits. | 60 |
overflowSpeed | numberWith speed 0, text wider than the display scrolls at this speed instead of being cut off. 0 clips it. | 40 |
direction | "left"Which way the text travels. | "left" |
rows | numberDot rows. The font is centered vertically in taller displays and cropped in shorter ones. | 7 |
columns | numberFixed width in dots. Leave unset to fill the parent's width. | None |
dotSize | numberDot diameter in pixels. | 6 |
gap | numberSpace between dots in pixels. | 2 |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
Accessibility
- Screen readers get the whole message once from the role="img" label; the canvas is aria-hidden. Pass aria-label to override.
- It's one canvas, not a node per dot. The text steps a whole column at a time like real LEDs, and the canvas only redraws when it moves.
- The canvas follows the neon color live, including a color inherited from an ancestor's --neon-accent.
- Scrolling pauses offscreen and in background tabs. With reduced motion it draws one still frame.