Marquee
A continuously scrolling ticker of content — logos, announcements, testimonials. The items are the component's default-slot children; they are cloned to loop seamlessly. It pauses on hover, supports drag-to-scrub, and honors prefers-reduced-motion (no auto-scroll). The piece wraps the @magic-spells/scrolling-content web component rather than reimplementing it.
Installation
Copy the piece into your app — it compiles with your build and the code is yours:
puzzle add piece marquee
It has one runtime dependency — the web component it wraps:
npm install @magic-spells/scrolling-content
Then merge its stylesheet into your app's style entry. It is required: the host's overflow, the track's max-content sizing that the clone measurement is derived from, the gap variable, the drag cursors and the edge-fade mask all live there.
/* app/styles/styles.css */ @import "@magic-spells/scrolling-content/css" layer(components);
Requires the pieces.css tokens merged into your app styles (see Introduction).
Usage
import Marquee from '@/components/ui/Marquee.pzl';
<Marquee class="w-full rounded-xl border border-border bg-surface py-4"></Marquee>
Direction
Announcement bar
Pause on hover (off)
Speed
Edge fade
Gap
Live content
Behavior
- Seamless loop — the slotted content is measured and cloned enough times to overfill the viewport; the track wraps by exactly one copy's width so there is never a gap
- Pause on hover — the scroll stops while the pointer is over the marquee (mouse only); disable with
pauseOnHover={ false } - Drag to scrub — press and drag horizontally to move the ticker by hand; touch drags the marquee while still letting the page scroll vertically. Opt out with
drag={ false } - Clones are inert — every filler copy carries
data-clone,aria-hiddenandinert, with ids stripped, so a cloned link is never a focus stop - Edits rebuild the clones — change the slotted content and every copy is rebuilt on the next frame, automatically
- Reduced motion — under
prefers-reduced-motionthe auto-scroll never starts; the content renders static and the duplicate copies arearia-hiddenso assistive tech reads the sequence once