Marquee
WCAG 2.2 AA compliant scrolling content component with pause controls.
Installation
npx vayu-ui init #one time onlynpx vayu-ui add marqueenpx vayu-ui add -t marquee #with test case needsUsage
Marquee Component
WCAG 2.2 AA compliant scrolling content component with pause controls
Basic Marquee
Default settings with pause control (WCAG 2.2.2)
Speed Variants
Slow (40s), Normal (20s), Fast (10s)
Direction Control
Left to right or right to left scrolling
Loop Modes
Infinite, finite, single, or ping-pong patterns
Ping-pong (alternating direction)
Finite (3 loops then stops)
No Controls (Not Recommended)
Without pause control - fails WCAG 2.2.2 Level A
No Edge Gradient
Without gradient fade on edges
Logo Showcase Example
Typical use case for partner logos or testimonials
WCAG 2.2 AA Compliance
2.2.2 (Level A): Pause control provided by default for all moving content
2.3.3: Respects prefers-reduced-motion setting - animations disabled for users who prefer reduced motion
2.4.7 (Level AA): Focus indicator visible on pause control button
4.1.2 (Level A): Proper ARIA labels (role="region", aria-roledescription, aria-label)
<Marquee pauseOnHover label="Featured technologies">
<MarqueeItem>React</MarqueeItem>
<MarqueeItem>TypeScript</MarqueeItem>
<MarqueeItem>Tailwind CSS v4</MarqueeItem>
<MarqueeItem>Next.js</MarqueeItem>
</Marquee>
<Marquee speed="fast" direction="right" label="Fast scrolling right">
<MarqueeItem>Fast 1</MarqueeItem>
<MarqueeItem>Fast 2</MarqueeItem>
</Marquee>
<Marquee loopMode="ping-pong" label="Ping-pong scrolling content">
<MarqueeItem>Item 1</MarqueeItem>
<MarqueeItem>Item 2</MarqueeItem>
</Marquee>Anatomy
import { Marquee, MarqueeItem } from 'vayu-ui';
export default () => (
<Marquee pauseOnHover label="Marquee Label">
<MarqueeItem>Item 1</MarqueeItem>
<MarqueeItem>Item 2</MarqueeItem>
</Marquee>
);Accessibility
- Keyboard support:
Tabto focus on the pause/play control button.EnterorSpacetoggles the play/pause state. - ARIA attributes: Uses
role="region",aria-roledescription="marquee", andaria-labelfor semantic meaning. The pause button usesaria-pressedandaria-label. - Focus behavior: Focus indicator is clearly visible on the pause control button. Animation pauses on hover or when interacting with controls, fulfilling WCAG 2.2.2 (Level A). Respects
prefers-reduced-motionsettings (WCAG 2.3.3).
Screen reader behavior
Screen readers will announce the component as a "marquee" region with the provided accessible label. Users can interact with the pause/play button securely, enabling them to control the scrolling animation independently to read the content without a time constraint.
Component Folder Structure
Marquee/
├── index.ts
├── types.ts
├── Marquee.tsx
├── MarqueeItem.tsx
└── README.mdProps
Marquee
| Prop | Type | Description |
|---|---|---|
speed | "slow" | "normal" | "fast" | The speed of the scroll animation. Default: "normal". |
direction | "left" | "right" | The direction of the scroll. Default: "left". |
pauseOnHover | boolean | Whether to pause animation on hover. Default: true. |
gradient | boolean | Whether to apply edge gradient fade. Default: true. |
showControls | boolean | Whether to show pause/play control button. Default: true. |
label | string | Accessible label for the marquee region. |
loopMode | "infinite" | "finite" | "single" | "ping-pong" | The loop mode for the animation. Default: "infinite". |
loopCount | number | Number of loops when loopMode is "finite". Default: 1. |
MarqueeItem
| Prop | Type | Description |
|---|---|---|
children | React.ReactNode | The content to render inside the marquee item. |