Marquee
Use Marquee for a row of short items that don’t all fit and that people only need to glance at: a ticker, a strip of logos, a line of announcements. Content people must read carefully, click or act on should stay still: let it scroll by hand in a ScrollArea, or wrap it with Flex.
Marquee scrolls its content sideways in a loop. The motion is a CSS animation: the content and a copy of it move by their own width, so the loop is seamless, and the duration comes from the measured width and speed. The copies are hidden from assistive tech and can’t take focus.
With reduced motion turned on in the system, the marquee stands still and its content scrolls by hand in a ScrollArea when it overflows.
#Demos
#Basic
Put any content in. Give it some space at the end (here padding-inline-end) so it doesn’t run into itself when it comes round.
#Auto fill
autoFill repeats short content until it fills the width, so there is no blank before it comes round again.
#Speed
speed is in px per second, so the same speed reads the same whatever the content’s width.
#Direction
#Pause on hover
pauseOnHover stops the marquee while the pointer is over it or focus is inside it, so people can read it or use a link in it.
#Marquee Props
| Name | Type | Default | Description | Version |
|---|---|---|---|---|
autoFill | boolean | false | Repeats the content to fill the width. | Unreleased |
direction | left | right | left | Which way the content moves. | Unreleased |
pauseOnHover | boolean | false | Pauses while hovered or focused within. | Unreleased |
speed | number | 48 | Speed in px per second. | Unreleased |
The content fades out at the edges (--p-marquee-fade-width).