Dice UI

Marquee

An animated scrolling component that continuously moves content horizontally or vertically.

API

Installation

pnpm dlx shadcn@latest add "@diceui/marquee"

Layout

Import the parts and compose them together.

import * as Marquee from "@/components/ui/marquee"
 
return (
  <Marquee.Root>
    <Marquee.Content>
      <Marquee.Item />
    </Marquee.Content>
    <Marquee.Edge side="left" />
    <Marquee.Edge side="right" />
  </Marquee.Root>
)

Examples

Logo Showcase

Use the marquee to showcase logos or brands in a continuous scroll.

Vertical Layout

Use side to control the direction of the marquee.

With RTL

The marquee component automatically adapts to RTL (right-to-left) layouts.

API Reference

Marquee

The main marquee component that creates continuous scrolling animations.

Prop

Type

Data AttributeValue
[data-orientation]"horizontal" | "vertical"
CSS VariableDescriptionDefault
--marquee-durationThe duration of the marquee animation in seconds. Calculated based on content size and speed.Calculated dynamically (e.g., 20s)
--marquee-gapThe gap between marquee items and repetitions.1rem
--marquee-delayThe delay before the marquee animation starts in seconds.0s
--marquee-loop-countThe number of times the animation should repeat. Can be a number or 'infinite'.infinite

MarqueeContent

Contains the scrolling content and handles repetition for seamless animation.

Prop

Type

Data AttributeValue
[data-orientation]"horizontal" | "vertical"

MarqueeItem

Individual items within the marquee content.

Prop

Type

MarqueeEdge

Edge overlay components for smooth gradient transitions.

Prop

Type

Data AttributeValue
[data-size]"default" | "sm" | "lg"

Accessibility

Keyboard Interactions

KeyDescription
SpacePauses or resumes the marquee animation when pauseOnKeyboard is enabled.

Features

  • RTL Support: Automatically adapts to RTL (right-to-left) layouts
  • Screen Reader Support: Content remains accessible to assistive technologies
  • Reduced Motion: Respects user's prefers-reduced-motion setting
  • Pause Controls:
    • Hover: Can be configured to pause animation when hovered
    • Keyboard: Press Space key to pause/resume (when pauseOnKeyboard is enabled)
  • Focus Management: Proper focus indicators and keyboard navigation when pauseOnKeyboard is enabled

On this page