Ballmac UI home

Scroll Velocity

A looping row of text or logos that drifts sideways and speeds up, or reverses, with how fast you scroll the page or any scroll container, repeating itself to fill the width.

DesignBuild
ShipRepeat

Scroll inside this box

Installation

$ pnpm dlx shadcn@latest add @ballmac/scroll-velocity

Usage

import { ScrollVelocity } from "@/components/ballmac/scroll-velocity"

The full example is in the Code tab above.

Examples

Logo row

NorthwindAcmeGlobexInitechUmbrellaHooliStarkWayne

API reference

PropTypeDefault
children*

What runs along the row: words, logos, anything. It is repeated to fill the width.

React.ReactNode—
baseVelocity

Pixels per second when the page is still.

number60
direction

Which way the row drifts when still. Scrolling down pushes it the way it already goes; scrolling up reverses it.

"left" | "right""left"
sensitivity

How strongly scrolling speeds the row up. 0 turns it off.

number1
scrollContainer

A scrollable element to watch instead of the page. Pass a ref to it.

React.RefObject<HTMLElement | null>—
gap

Gap between repeats, as a CSS length.

string"2rem"

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Screen readersOnly the first copy is read; repeats are hidden and not focusable
Reduced motionA static, horizontally scrollable row

Use with AI

<ScrollVelocity baseVelocity direction sensitivity scrollContainer gap>content</ScrollVelocity>. Stack rows with opposite directions. Repeats are aria-hidden and inert; reduced motion shows one scrollable row. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Scroll Velocity (@ballmac/scroll-velocity) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Big typographic dividers between sections
  • Logo and keyword strips that react to scrolling

Not for

  • A steady marquee that ignores scroll (marquee)

Registry JSON: https://ui.ballmac.com/r/scroll-velocity.json

Credits

Free to use in personal and commercial projects.