Skip to content

Endless Carousel

Image carousel wrapped around a 3D cylinder.

Usage

Usage
import { EndlessCarousel } from '@/components/ui/endless-carousel'


<EndlessCarousel />


// Your own images and motion
<EndlessCarousel
  className="h-[480px]"
  items={[
    { src: '/shots/one.webp', alt: 'Serum on stone', width: 1200, height: 1600 },
    { src: '/shots/two.webp', alt: 'Cream tube', href: '/products/cream', caption: 'Day cream' },
    { src: '/shots/three.webp', alt: 'Dropper bottle' },
  ]}
  count={16}
  speed={-0.08}
  pauseOnHover
  camera={{ yaw: 20, fov: 62 }}
  fog={{ color: '#FAF5F5', near: 14, far: 34 }}
/>

Install

pnpm dlx shadcn@latest add @pastaui-pro/endless-carousel

Source

Props

Endless Carousel props
PropTypeDefaultDescription
items{ src: string; alt: string; width?: number; height?: number; href?: string; caption?: string }[]= 12 gallery imagesImages around the cylinder. They repeat to fill count; repeats are hidden from assistive tech. href turns a card into a link, caption adds a label under it.
countnumber= 14Cards around the full circle (at least the number of items).
radiusnumber= 12Cylinder radius in scene units.
itemWidthnumber= 5.3Card width in scene units, measured along the curve.
itemHeightnumber= 7.6Card height in scene units.
speednumber= 0.05Auto-rotation in radians per second (one turn in about 2 minutes). Negative reverses the direction.
dampingnumber= 14How quickly the rotation catches up to drags. Lower is floatier.
dragSensitivitynumber= 0.005Radians of rotation per pixel dragged.
startAnglenumber= 0Initial rotation in degrees.
camera{ x?: number; y?: number; z?: number; yaw?: number; fov?: number }= { x: 5, y: 0.5, z: 11, yaw: 24, fov: 58 }Camera position, yaw in degrees, and vertical field of view in degrees.
fog{ color?: string; near?: number; far?: number } | false= { color: '#000000', near: 16, far: 38 }Distance fade toward a color, like three.js linear fog. Pass false to turn it off.
segmentsnumber= 6Vertical slices per card used to bend it along the curve. Higher is smoother.
autoPlayboolean= trueRotate on its own. Always off when the user prefers reduced motion.
pauseOnHoverboolean= falsePause auto-rotation while a mouse is over the carousel.
draggableboolean= trueRotate by dragging with mouse, touch, or pen. Arrow keys turn it while a control inside has focus.
showControlsboolean= trueShow the pause/play button while auto-rotation can run.
labelstring= 'Image carousel'Accessible name for the carousel region.
classNamestring= —Additional classes. The carousel needs a height; it defaults to h-[36rem].