Cylinder Carousel

A horizontal carousel that bends items around a cylinder: concave makes the middle item smallest and enlarges toward the edges, convex does the reverse. Roll it by drag, mouse wheel or arrow keys, snap to items, or let it auto-rotate until someone touches it.

Preview

Cylinder Carousel preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/cylinder-carousel
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

itemSize?
number

Max item box size in px (square) at full size, i.e. at the container edge. Balls shrink below this automatically so the row keeps breathing room in narrow containers.

200
visibleItems?
number

How many item slots span the container width.

5
variant?
"concave" | "convex"

"concave" (default): inside of the cylinder — center ball smallest and dipped, growing toward the edges. "convex": outside of the cylinder — center ball biggest and raised, shrinking toward the edges.

concave
minScale?
number

Scale of the smallest ball (center for concave, edges for convex); the biggest reaches 1.

0.55
dragSpeed?
number

Items rolled per item-width dragged — above 1 the wall outruns the pointer, which reads as a lighter, freer roll.

1.5
arc?
number

Curve depth in px: for concave, how far the edge balls ride above the center one (valley); for convex, how far below (arch). 0 = flat line. Defaults to 35% of the item size.

—
snap?
boolean

Snap to the nearest item when the roll settles.

true
autoRotate?
boolean

Roll on its own until interacted with.

false
autoRotateSpeed?
number

Auto-roll speed in items per second.

0.4
defaultIndex?
number
0
onIndexChange?
((index: number) => void)
—
height?
number

Stage height in px. Defaults to `itemSize`.

—
className?
string
—

Updated