Marquee

Renders a looping marquee animation with horizontal or vertical scrolling. Supports adjustable speed, direction, repeat count, and pause on hover.

marquee-01

marquee-02

marquee-03

marquee-04

marquee-05

Installation

pnpm dlx shadcn@latest add https://aliimam.in/r/marquee.json

Usage

import { Marquee } from "@/components/marquee"
// Basic
<Marquee>
  <div>Item 1</div>
  <div>Item 2</div>
</Marquee>
 
// With fade and custom speed
<Marquee speed={25} fade={true} gap="20px">
  <img src="logo1.png" />
  <img src="logo2.png" />
</Marquee>
 
// Vertical with delay
<Marquee vertical delay={2} pauseOnHover>
  <Card>Content</Card>
</Marquee>
 
// Auto-fill responsive
<Marquee autoFill speed="slow" reverse>
  <Badge>Tag</Badge>
</Marquee>

CSS

@import "tailwindcss";
@import "tw-animate-css";
 
@theme inline {
  --animate-marquee: marquee var(--duration) infinite linear;
  --animate-marquee-vertical: marquee-vertical var(--duration) linear infinite;
}
 
 
@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-100% - var(--gap)));
  }
}
 
@keyframes marquee-vertical {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(calc(-100% - var(--gap)));
  }
}

Props

PropTypeDefault
childrenReact.ReactNode
classNamestring
reversebooleanfalse
pauseOnHoverbooleanfalse
verticalbooleanfalse
repeatnumber5
speed"slow" | "normal" | "fast"normal