DocsBlog

Get Started

Components

Data Grid

Signals

Styling

Theming

↑↓Navigate
↵Select
EscClose
  • 1.8.0

  • Day

    Night

    Preview

    Switch mode
  • cerberus

    acheron

    elysium

    oceanus

Get Started
Components
Data Grid
Signals
Styling
Theming

Concepts

OverviewCompositionCerberus ContextTesting

Layout

Aspect RatioBleedBoxCenterContainerContainer QueryDividerFlexFloatGridGroupLink OverlayScrollableStackWrap

Components

AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTA ModalDate PickerDialogFieldFieldsetFile UploaderIconButtonInputLoading StatesMarqueeMenuNotificationsNumber InputPaginationPin InputPopoverProgress IndicatorsPrompt ModalRadioRatingSelectSliderSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

Utilities

Client OnlyDownload TriggerEnvironmentFeature FlagsFocus TrapForFormat ByteFormat NumberFormat Relative TimeFormat Relative TimeFrameHighlightJSON Tree ViewLocalePortalPresenceShowSwapsplitPropsTheme

Marquee

A marquee component that scrolls text horizontally.

  • npm
  • source
  • recipe
  • Ark
View as Markdown
Open this page in Markdown
Anthropic
Open in Claude
Ask questions about this page
OpenAI
Open in ChatGPT
Ask questions about this page

Import

import { Marquee } from '@cerberus/react'

Usage

The Marquee is an abracted API that combines multiple primitives into a single root component.

Loading example...

Spacing

Use the spacing prop to control the gap between content instances.

Loading example...

Reverse

Use the reverse prop to reverse the direction of the marquee.

Loading example...

Vertical Animation

Use the side prop to animate the marquee vertically. The options are top and bottom.

Loading example...

Speed

Use the speed prop to control the animation speed in pixels per second.

Loading example...

Edges

Use the edges prop to display stylized edges on the marquee. The options are both, start, and end.

Loading example...

Pause on Interaction

Use the pauseOnInteraction prop to pause the marquee when users hover or focus on it, improving accessibility.

Loading example...

Context

Access the combobox's state with ComboboxContext or the useComboboxContext hook—useful for displaying the selected value or building custom UI.

Note

Since combobox is an abstracted API, you'll need to build your own to obtain the context as we do in the example below.

Loading example...

Finite Loops

To loop the marquee a finite number of times, set the loopCount prop on Marquee. Alternatively, use the onLoopComplete and onComplete callbacks to track the number of completed loops or when the animation fully finishes.

Loading example...

Guides

CSS Variables

The marquee component exposes CSS variables that can be used to customize its behavior and appearance.

Loading example...
VariableDescriptionDefault
--marquee-durationAnimation durationComputed
--marquee-delayAnimation delay before starting0s
--marquee-loop-countNumber of animation iterationsinfinite
--marquee-edge-colorColor for the edge gradient overlaypage.surface.initial
--marquee-edge-sizeSize of the edge gradient20%

Primitives

You can utilize the primitive components or the css prop to customize the Marquee.

ComponentDescription
MarqueeRootThe context provider for the Marquee family
MarqueeEdgeThe stylistic edge of the Marquee
MarqueeViewportThe viewport container that holds the Marquee content
MarqueeContentThe content of the Marquee
MarqueeItemThe item to be displayed in the Marquee

API

Root Props

PropTypeRequiredDescription
asChildbooleanNoUse the provided child element as the default rendered element, combining their props and behavior.
autoFillbooleanNoWhether to automatically duplicate content to fill the container.
defaultPausedbooleanNoWhether the marquee is paused by default.
delaynumberNoThe delay before the animation starts (in seconds).
idsPartial<{ root: string; viewport: string; content: (index: number) => string }>NoThe ids of the elements in the marquee. Useful for composition.
loopCountnumberNoThe number of times to loop the animation (0 = infinite).
onComplete() => voidNoFunction called when the marquee completes all loops and stops. Only fires for finite loops (loopCount > 0).
onLoopComplete() => voidNoFunction called when the marquee completes one loop iteration.
onPauseChange(details: PauseStatusDetails) => voidNoFunction called when the pause status changes.
pausedbooleanNoWhether the marquee is paused.
pauseOnInteractionbooleanNoWhether to pause the marquee on user interaction (hover, focus).
reversebooleanNoWhether to reverse the animation direction.
sideSideNoThe side/direction the marquee scrolls towards.
spacingstringNoThe spacing between marquee items.
speednumberNoThe speed of the marquee animation in pixels per second.
translationsIntlTranslationsNoThe localized messages to use.

Root Data Attributes:

AttributeValue
[data-scope]marquee
[data-part]root
[data-state]"paused" | "idle"
[data-orientation]The orientation of the marquee
[data-paused]Present when paused

Root CSS Variables:

VariableDescription
--marquee-durationThe marquee duration value for the Root
--marquee-spacingThe marquee spacing value for the Root
--marquee-delayThe marquee delay value for the Root
--marquee-loop-countThe marquee loop count value for the Root
--marquee-translateThe marquee translate value for the Root

Content Props:

PropTypeRequiredDescription
asChildbooleanNoUse the provided child element as the default rendered element, combining their props and behavior.

Content Data Attributes:

AttributeValue
[data-scope]marquee
[data-part]
[data-index]The index of the item
[data-orientation]The orientation of the content
[data-side]
[data-reverse]
[data-clone]

Edge Props:

PropTypeRequiredDescription
sideSideYesThe side where the edge gradient should appear.
asChildbooleanNoUse the provided child element as the default rendered element, combining their props and behavior.

Edge Data Attributes:

AttributeValue
[data-scope]marquee
[data-part]
[data-side]
[data-orientation]The orientation of the edge

Item Props:

PropTypeRequiredDescription
asChildbooleanNoUse the provided child element as the default rendered element, combining their props and behavior.

Viewport Props:

PropTypeRequiredDescription
asChildbooleanNoUse the provided child element as the default rendered element, combining their props and behavior.

Viewport Data Attributes:

AttributeValue
[data-scope]marquee
[data-part]
[data-orientation]The orientation of the viewport
[data-side]

RootProvider Props:

PropTypeRequiredDescription
valueUseMarqueeReturnYes
asChildbooleanNoUse the provided child element as the default rendered element, combining their props and behavior.

Parts

The Marquee API is an Object containing the full family of components.

NameDescription
RootThe context provider for the Marquee family
EdgeThe stylistic edge of the Marquee
ViewportThe viewport container that holds the Marquee content
ContentThe content of the Marquee
ItemThe item to be displayed in the Marquee

On this page

  • Import
  • Usage
  • Spacing
  • Reverse
  • Vertical Animation
  • Speed
  • Edges
  • Pause on Interaction
  • Context
  • Finite Loops
  • Guides
    • CSS Variables
  • Primitives
  • API
    • Root Props
      • Root Data Attributes:
      • Root CSS Variables:
    • Content Props:
      • Content Data Attributes:
    • Edge Props:
      • Edge Data Attributes:
    • Item Props:
    • Viewport Props:
      • Viewport Data Attributes:
    • RootProvider Props:
    • Parts
Edit this page on Github
Apple 🍎
Banana 🍌
Cherry 🍒
Grape 🍇
Watermelon 🍉
Strawberry 🍓
Apple 🍎
Banana 🍌
Cherry 🍒
Grape 🍇
Watermelon 🍉
Strawberry 🍓
Apple 🍎
Banana 🍌
Cherry 🍒
Grape 🍇
Watermelon 🍉
Strawberry 🍓
Apple 🍎
Banana 🍌
Cherry 🍒
Grape 🍇
Watermelon 🍉
Strawberry 🍓

Slow (25pxps)

Normal (50pxps)

Fast (100pxps)

Apple 🍎
Banana 🍌
Cherry 🍒
Grape 🍇
Watermelon 🍉
Strawberry 🍓
Apple 🍎
Banana 🍌
Cherry 🍒
Grape 🍇
Watermelon 🍉
Strawberry 🍓

Loop completed: 0

Animation completed: 0

Copy
import { Marquee } from '@cerberus/react/react'

export function VarsDemo() {
  return (
    <Marquee
      css={{
        '--marquee-duration': '30s',
        '--marquee-delay': '0s',
        '--marquee-loop-count': 'infinite',
        '--marquee-edge-color': 'colors.bg',
        '--marquee-edge-size': '20%',
      }}
    >
      {/* ... */}
    </Marquee>
  )
}