Marquee
An animated scrolling component that continuously moves content horizontally or vertically.
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 Attribute | Value |
|---|---|
[data-orientation] | "horizontal" | "vertical" |
| CSS Variable | Description | Default |
|---|---|---|
--marquee-duration | The duration of the marquee animation in seconds. Calculated based on content size and speed. | Calculated dynamically (e.g., 20s) |
--marquee-gap | The gap between marquee items and repetitions. | 1rem |
--marquee-delay | The delay before the marquee animation starts in seconds. | 0s |
--marquee-loop-count | The 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 Attribute | Value |
|---|---|
[data-orientation] | "horizontal" | "vertical" |
MarqueeItem
Individual items within the marquee content.
Prop
Type
MarqueeEdge
Edge overlay components for smooth gradient transitions.
Prop
Type
| Data Attribute | Value |
|---|---|
[data-size] | "default" | "sm" | "lg" |
Accessibility
Keyboard Interactions
| Key | Description |
|---|---|
| Space | Pauses 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-motionsetting - Pause Controls:
- Hover: Can be configured to pause animation when hovered
- Keyboard: Press Space key to pause/resume (when
pauseOnKeyboardis enabled)
- Focus Management: Proper focus indicators and keyboard navigation when
pauseOnKeyboardis enabled