All components (283)
Moving strip
Utilities · Marquee · .amset-marquee
What it is and when to use it
A strip that scrolls by itself: logos, short notices. It stops with the mouse over it or with focus inside, and has a pause button, because something that moves by itself for more than five seconds must be able to stop.
When to use it
- Client logos or a short notice that is not essential.
durationis the seconds of a lap anddirectionthe way it goes.
When not to
- What must be read:
Alert. Nothing important should depend on someone seeing it go by. - Items to go through one by one:
Carousel.
Keyboard: Tab reaches what is inside, which keeps the strip still while it has focus, and the pause button.
Accessibility: the copy that hides the lap is hidden from the reader and out of the tab order. With reduced motion it does not move: it stays as a row that scrolls by hand.
Fine-tuning: --amset-marquee-gap is the gap between items.
What it looks like
<Marquee label="Shop notices" duration={36}>
<Tag>Free shipping over €50</Tag>
<Tag>Engraving included on rings</Tag>
<Tag>30-day returns</Tag>
<Tag>925 sterling silver</Tag>
</Marquee>Props
Import it with import { Marquee } from '@amset/ui'. Required props are marked.
| Prop | Type | What it does |
|---|---|---|
childrenrequired | ReactNode | — |
labelrequired | string | What is being shown: "Brands that trust us". |
autoFill | boolean | Repeats the content as many times as needed so there is no gap on a wide screen. |
className | string | Merged with the library classes; it does not replace them. |
defaultPaused | boolean | — |
delay | number | Seconds to wait before starting. |
direction | "start" | "end" | Which way it moves. By default, towards the start of the line. |
duration | number | Seconds it takes for one lap. By default, 30. |
gap | number | Space between items, in pixels. Defaults to the theme one. |
loop | number | How many laps it does before stopping. Defaults to 0: it never ends. |
onCycleComplete | () => void | Called every time a lap ends. |
onPausedChange | (paused: boolean) => void | — |
orientation | "horizontal" | "vertical" | Axis of the movement. When vertical, the strip needs a height (through `style` or a class). Defaults to horizontal. |
paused | boolean | Pause controlled from outside. |
pauseOnClick | boolean | Clicking the strip pauses and resumes it. |
speed | number | Pixels per second. When given, it wins over `duration`: the speed does not change with the width of the content. |
It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.
CSS variables
These CSS variables are how you adapt it. Declare them on the component's selector, not on :root: the stylesheet redeclares them in the rule itself, and a declaration on the same element always wins.
| Variable | Default |
|---|---|
--amset-marquee-gap | var(--amset-space-5) |
How to change it
.amset-marquee {
--amset-marquee-gap: ...;
}In the test bench
Every state and variant, to try one at a time, on its page at storybook.amsetui.com:
