Skip to content
Textlab
1
Browse

ComponentsScroll

Velocity marquee

A marquee that speeds up, slows and reverses with scroll.

Scroll up and down inside the preview ↓
Available for new projects

Installation

$ npx shadcn@latest add @textlab/velocity-marquee

Needs @textlab in your components.json. Setup takes a minute.

Usage

usage.tsx
import { VelocityMarquee } from "@/components/textlab/velocity-marquee/velocity-marquee";

<VelocityMarquee text="Available for new projects" />

Variants

singledoubleoutline

Props

PropTypeDefaultDescription
text*string–The copy.
variant"single" | "double" | "outline""single"One row, two rows in opposite directions, or alternating solid and hollow copies.
speednumber6Resting speed in percent of one copy per second.
boostnumber4How much scroll speed adds.
separatorstring"✦"Mark between copies.
pauseOnHoverbooleantruePause while hovered or focused so it can be read.
containerRefObject<HTMLElement>–Scrollable ancestor. Defaults to the window.
asElementType"div"Rendered element.
reducedMotion"user" | "always" | "never""user"user follows the OS setting; always shows the still version.
classNamestring–Merged onto the root.

When to use it

Reach for it

  • Bold bands between sections on marketing pages.
  • Announcements and logos-as-text strips.

Skip it

  • Essential information; moving text is hard to read.
  • More than two marquees on one page.

Accessibility and motion

Accessibility

  • Screen readers read the text once.
  • Hover and focus pause it, meeting WCAG 2.2.2 for moving content.

Motion

  • Direction follows the last scroll direction and stays there.
  • Speed eases back to rest on a spring when scrolling stops.
Reduced motion. A single, still line.

Performance

  • One transform per row, updated in a frame loop that pauses offscreen.