Skip to content
VenusUI
Get started

Marquee

Scrolls content in an endless loop, horizontally or vertically.

Preview

Installation

npx shadcn@latest add @venusui/marquee

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/marquee.tsx

Usage

The code behind the preview above.

marquee-demo.tsx

import { Marquee } from "@/components/ui/marquee"

const stack = ["Next.js", "React", "Tailwind CSS", "TypeScript", "Radix UI", "Motion", "Vercel", "Supabase"]

export default function MarqueeDemo() {
  return (
    <div className="w-full max-w-xl space-y-3 [mask-image:linear-gradient(to_right,transparent,#000_15%,#000_85%,transparent)]">
      <Marquee pauseOnHover duration="30s">
        {stack.map((item) => (
          <span key={item} className="rounded-md border bg-card px-3 py-1.5 text-sm whitespace-nowrap">
            {item}
          </span>
        ))}
      </Marquee>
      <Marquee reverse pauseOnHover duration="30s">
        {stack.map((item) => (
          <span key={item} className="rounded-md border bg-card px-3 py-1.5 text-sm whitespace-nowrap text-muted-foreground">
            {item}
          </span>
        ))}
      </Marquee>
    </div>
  )
}

API reference

PropTypeDefaultDescription
reversebooleanfalseScroll in the opposite direction.
pauseOnHoverbooleanfalsePause while the pointer is over the marquee.
verticalbooleanfalseScroll top-to-bottom instead of sideways.
repeatnumber4Copies of the children. Raise it if a gap shows on very wide screens.
durationstring"40s"Time for one loop, as a CSS duration.
gapstring"1rem"Space between items, as a CSS length.

All <div> props, including className and style.

Requirements

  • Tailwind CSS v4. The CLI adds the marquee keyframes and --animate-marquee theme variables to your CSS.
  • A cn helper at @/lib/utils.

Customization

  • Fade the edges by wrapping the marquee in an element with a mask, e.g. [mask-image:linear-gradient(to_right,transparent,#000_15%,#000_85%,transparent)].
  • Stack two marquees with reverse on one for a woven look.
  • For vertical scrolling, give the marquee a fixed height, e.g. className="h-80".

Accessibility

  • Only the first copy is exposed to screen readers; the repeated copies are aria-hidden and inert, so links inside are reachable once.
  • Scrolling stops when the user prefers reduced motion.
  • Use pauseOnHover when items contain links or text people need to read.

Troubleshooting

Items jump at the end of each loop.
Check that --animate-marquee and the marquee keyframes are in your CSS, and that gap matches any spacing you add yourself.
A gap appears on wide screens.
Increase repeat so the copies cover the full width.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A tilted wall of vertically scrolling columns, for screenshots and showcases.

Loading preview

Background Beams

Backgrounds

Curved lines across a section with light traveling along them.

Loading preview

Beam Rain

Backgrounds

Beams of light fall to the floor and burst into sparks when they land.