Marquee
shadcncraft/marqueeFreeComponent
A smooth, endlessly looping scroller ideal for showcasing logos, testimonials, images, or sponsor lists. Features auto-play with customizable speed, pause-on-hover, reverse direction, and seamless loop behavior.
Install it
npx shadcn@latest add https://shadcncraft.com/r/marquee.jsonSource
1"use client";23import { cn } from "@/lib/utils";45interface MarqueeProps extends React.ComponentProps<"div"> {6 /**7 * Direction of the animation8 * @default "horizontal"9 */10 direction?: "horizontal" | "vertical";11 /**12 * Whether to reverse the animation direction13 * @default false14 */15 reverse?: boolean;16 /**17 * Whether to pause the animation on hover18 * @default false19 */20 pauseOnHover?: boolean;21 /**22 * Number of times to repeat the content23 * @default 424 */25 repeat?: number;26}2728function Marquee({29 className,30 reverse = false,31 pauseOnHover = false,32 children,33 direction = "horizontal",34 repeat = 4,35 ...props36}: MarqueeProps) {37 return (38 <div39 role="marquee"40 data-slot="marquee"41 data-direction={direction}42 data-reverse={reverse}43 data-pause-on-hover={pauseOnHover}44 data-repeat={repeat}45 className={cn(46 "group/marquee flex w-full min-w-0 gap-(--gap) overflow-hidden [--duration:20s] [--gap:1.25rem]",47 direction === "horizontal" ? "flex-row" : "flex-col",48 "has-data-[fade='left']:mask-l-from-80%",49 "has-data-[fade='right']:mask-r-from-80%",50 "has-data-[fade='top']:mask-t-from-80%",51 "has-data-[fade='bottom']:mask-b-from-80%",52 "has-data-[fade='vertical']:mask-y-from-80%",53 "has-data-[fade='horizontal']:mask-x-from-80%",54 className55 )}56 {...props}57 >58 {Array(repeat)59 .fill(0)60 .map((_, i) => (61 <div62 key={i}63 data-slot={`marquee-repeat-${i + 1}`}64 className={cn("flex min-w-0 shrink-0 justify-around gap-(--gap)", {65 "animate-marquee flex-row": direction === "horizontal",66 "animate-marquee-vertical flex-col": direction === "vertical",67 "group-hover/marquee:paused": pauseOnHover,68 "direction-[reverse]": reverse,69 })}70 >71 {children}72 </div>73 ))}74 </div>75 );76}7778function MarqueeFade({79 fade,80}: {81 fade: "left" | "right" | "top" | "bottom" | "horizontal" | "vertical";82}) {83 return (84 <div85 data-slot="marquee-fade"86 data-fade={fade}87 className="hidden"88 aria-hidden="true"89 />90 );91}9293export { Marquee, MarqueeFade };
Files it writes
More from shadcncraft
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Avatar Stackavatar-stack | shadcncraft | Components | Free | no deps | |
| Badgebadge | shadcncraft | Components | Free | no deps | |
| Featured Iconfeatured-icon | shadcncraft | Components | Free | no deps | |
| Image Zoomimage-zoom | shadcncraft | Components | Free | 1 dep | |
| Page Headingpage-heading | shadcncraft | Components | Free | no deps | |
| Placeholder Logoplaceholder-logo | shadcncraft | Components | Free | no deps | |
| Profile Cardprofile-card | shadcncraft | Components | Free | no deps | |
| Section Headingsection-heading | shadcncraft | Components | Free | no deps |
