VayuUI

Marquee

WCAG 2.2 AA compliant scrolling content component with pause controls.

Installation

npx vayu-ui init #one time only
npx vayu-ui add marquee
npx vayu-ui add -t marquee #with test case needs

Usage

Marquee Component

WCAG 2.2 AA compliant scrolling content component with pause controls

Basic Marquee

Default settings with pause control (WCAG 2.2.2)

React
TypeScript
Tailwind CSS v4
Next.js
Vite

Speed Variants

Slow (40s), Normal (20s), Fast (10s)

Slow 1
Slow 2
Slow 3
Slow 4
Slow 5
Slow 6
Fast 1
Fast 2
Fast 3
Fast 4
Fast 5
Fast 6

Direction Control

Left to right or right to left scrolling

→ Left 1
→ Left 2
→ Left 3
→ Left 4
→ Left 5
→ Left 6
← Right 1
← Right 2
← Right 3
← Right 4
← Right 5
← Right 6

Loop Modes

Infinite, finite, single, or ping-pong patterns

Ping-pong (alternating direction)

Ping-pong 1
Ping-pong 2
Ping-pong 3
Ping-pong 4
Ping-pong 5
Ping-pong 6

Finite (3 loops then stops)

Finite 1
Finite 2
Finite 3
Finite 4
Finite 5
Finite 6

No Controls (Not Recommended)

Without pause control - fails WCAG 2.2.2 Level A

No Control 1
No Control 2
No Control 3
No Control 4
No Control 5
No Control 6

No Edge Gradient

Without gradient fade on edges

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6

Logo Showcase Example

Typical use case for partner logos or testimonials

Acme Corp
TechVision
DataFlow Inc
CloudNine
DevTools Pro
AppMakers

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: Tab to focus on the pause/play control button. Enter or Space toggles the play/pause state.
  • ARIA attributes: Uses role="region", aria-roledescription="marquee", and aria-label for semantic meaning. The pause button uses aria-pressed and aria-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-motion settings (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.md

Props

Marquee

PropTypeDescription
speed"slow" | "normal" | "fast"The speed of the scroll animation. Default: "normal".
direction"left" | "right"The direction of the scroll. Default: "left".
pauseOnHoverbooleanWhether to pause animation on hover. Default: true.
gradientbooleanWhether to apply edge gradient fade. Default: true.
showControlsbooleanWhether to show pause/play control button. Default: true.
labelstringAccessible label for the marquee region.
loopMode"infinite" | "finite" | "single" | "ping-pong"The loop mode for the animation. Default: "infinite".
loopCountnumberNumber of loops when loopMode is "finite". Default: 1.

MarqueeItem

PropTypeDescription
childrenReact.ReactNodeThe content to render inside the marquee item.

On this page