Draggable Marquee
A continuous image marquee with drag momentum and a seamless looping track.
Drag the images, or focus the marquee and use the left and right arrow keys.
Component preview
Install using CLI
npx shadcn@latest add "https://www.obsidianui.dev/r/draggable-marquee.json"Usage
Code
"use client";
import { DraggableMarquee } from "@/components/block/draggable-marquee";
const items = [
{
"id": 1,
"src": "https://pub-830233752de349e29c6104a501b309d4.r2.dev/effects/draggable-marquee/draggable-marquee-img01.jpg",
"alt": "Landscape photograph 1",
"width": 420,
"height": 520,
"imageClassName": "h-[260px] w-[200px] rounded-2xl object-cover"
},
{
"id": 2,
"src": "https://pub-830233752de349e29c6104a501b309d4.r2.dev/effects/draggable-marquee/draggable-marquee-img02.jpg",
"alt": "Landscape photograph 2",
"width": 420,
"height": 520,
"imageClassName": "h-[260px] w-[200px] rounded-2xl object-cover"
},
{
"id": 3,
"src": "https://pub-830233752de349e29c6104a501b309d4.r2.dev/effects/draggable-marquee/draggable-marquee-img03.jpg",
"alt": "Landscape photograph 3",
"width": 420,
"height": 520,
"imageClassName": "h-[260px] w-[200px] rounded-2xl object-cover"
},
{
"id": 4,
"src": "https://pub-830233752de349e29c6104a501b309d4.r2.dev/effects/draggable-marquee/draggable-marquee-img04.jpg",
"alt": "Landscape photograph 4",
"width": 420,
"height": 520,
"imageClassName": "h-[260px] w-[200px] rounded-2xl object-cover"
}
];
export default function Demo() {
return <DraggableMarquee items={items} speed={1} className="py-8" />;
}Install Manually
1
Install dependencies
npm install gsap
2
Copy the source code
Copy into components/block/draggable-marquee.jsx
3
Add the CSS file
Copy into lib/effects/draggable-marquee/styles.css
Preview behavior
Drag the images, or focus the marquee and use the left and right arrow keys. The effect stays inside its container and respects reduced motion preferences.
Last updated on