Components

Marquee

A ticker written on a strip of washi tape. The text runs along it, fades at the ends, stops while you point at it or focus inside it, and has a pause button. With reduced motion it is a still strip with the text centered.

Install

terminal
npx shadcn@latest add @wobko/marquee

First time here? Add the registry to components.json first. How to install

Examples

Default

Point at it and it stops; so does Tab. The round button pauses it for good.

Tapes and directions

Any tape from the desk: masking, striped, gingham. direction="end" runs it the other way, speed sets px per second. (washi-dots is for short, large words: its white dots are as big as small letters.)

Announcement bar

A real use: the strip above a site header, with links in it. Only the first copy can be tabbed to, and the ticker holds still while a link has focus.

API reference

Marquee

The band: a strip of the engine's tape drawn to the width of the box, with the moving text in a clipped, edge-faded viewport. It repeats its content just enough times to fill the band and loops seamlessly with a CSS animation (keyframes come with the component).

PropTypeDefaultDescription
speednumber60px per second. A short text is never slower than a 4 second loop.
direction"start" | "end""start"Toward the start of the line (like a news ticker, mirrored in right-to-left) or away from it.
tape / colorTapeKind / Accent"washi-stripes"masking, washi-dots, washi-stripes, washi-zigzag, washi-gingham, kraft or clear; color is the print of a washi. `washi-dots` has white dots as big as small letters: keep it for short, large words and put customer names on `washi-gingham`, `washi-stripes` or `masking`.
paused / defaultPaused / onPausedChangeboolean-Controlled or uncontrolled pause. Hover and keyboard focus pause it as well.
controlsbooleantrueThe pause button. Leave it on for any ticker that runs more than five seconds.
labelstring"Ticker"Accessible name (role="marquee").

MarqueeItem

One phrase, followed by a small hand-drawn star. Pass `separator` for your own glyph, or `false` for none.

PropTypeDefaultDescription
separatorReactNode | false-What comes after the phrase.

Accessibility

  • Only the first copy of the text is exposed; every repeat is aria-hidden and inert, so a screen reader reads the ticker once and Tab does not visit links twice.
  • It pauses on hover and while focus is inside it (WCAG 2.2.2), and the pause button has aria-pressed. The button is on by default; do not remove it for a ticker that moves for more than five seconds.
  • Reduced motion (the OS setting or data-motion="reduced"): the animation is off, the repeats are hidden and the one copy is centered on the tape.
  • Put the words that matter in the first copy in the DOM order you want them read; the ticker itself is role="marquee", which assistive technology treats as a non-live region.
  • Ink on the default orange washi is 7:1 and on the dotted and gingham tapes above 6:1. The text is 24 px semibold script with a paper halo (a CSS text-shadow), so it holds on patterned tape; keep phrases short, and use `masking` when the words are long.
  • A short phrase on a wide screen is repeated as often as it takes to fill the band (at most 48 copies, all but the first hidden and inert).

Source

The files the CLI copies into your project.

Loading the source