- Add the registry
- Add marquee
Usage
The marquee repeats its children as many times as it takes to fill it, so the loop never shows a
gap. It moves them speed pixels per second with the Web Animations API, so the browser runs the
animation off the main thread. Set --marquee-gap on the marquee to change the space between
items, and --marquee-fade to change how far in from each end the content fades. Turn the fade off
with fade={false}.
The marquee slows to a stop while the pointer is over it or a finger touches it, unless you set
pauseOnHover={false}. It also stops while something inside it has keyboard focus, and scrolls the
focused element into view. Screen readers read the content once, since the copies are hidden from
them and are left out of the tab order. Users can still click or tap the links and buttons in
every copy.
For users who ask their system to reduce motion, the marquee stays still. If they need to reach
content that doesn't fit, set drag or wheel, or add a pause button.
Moving content that runs for more than a few seconds needs a way to stop it.
Examples
Reverse
reverse moves the content toward the end instead of the start.
Drag and scroll
drag lets users grab and fling the marquee, or swipe it on a touch screen. wheel lets them
scroll it with a mouse wheel or trackpad. A drag that moves the marquee doesn't count as a click on
the content inside it.
Vertical
Set orientation="vertical" to move the content upward, and give the marquee a height.
Setup took five minutes, and the defaults were already what we wanted.
Our designers and engineers finally agree on what a button looks like.
We replaced three internal libraries with it in a week.
The docs answer the question before I think to ask it.
Dark mode just worked, which has never happened to me before.
Pause button
paused stops the marquee, easing to a stop as it does on hover.
Props
Base UI's styling (opens in a new tab) and composition (opens in a new tab) guides say more about className, style and render.