Skip to content
EspañolEnglish
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.
  • duration is the seconds of a lap and direction the 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

Free shipping over €50Engraving included on rings30-day returnsOur own workshop in Seville925 sterling silverPay in three interest-free instalments

<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.

PropTypeWhat it does
childrenrequiredReactNode—
labelrequiredstringWhat is being shown: "Brands that trust us".
autoFillbooleanRepeats the content as many times as needed so there is no gap on a wide screen.
classNamestringMerged with the library classes; it does not replace them.
defaultPausedboolean—
delaynumberSeconds to wait before starting.
direction"start" | "end"Which way it moves. By default, towards the start of the line.
durationnumberSeconds it takes for one lap. By default, 30.
gapnumberSpace between items, in pixels. Defaults to the theme one.
loopnumberHow many laps it does before stopping. Defaults to 0: it never ends.
onCycleComplete() => voidCalled 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.
pausedbooleanPause controlled from outside.
pauseOnClickbooleanClicking the strip pauses and resumes it.
speednumberPixels 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.

VariableDefault
--amset-marquee-gapvar(--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: