ui · 6 variants · 1 categories
Carousel
Transform-based slider with drag / swipe (touch + mouse), keyboard navigation, pause-on-hover autoplay, configurable slidesPerView and loop, across dots / arrows / thumbs / cards / circular / progress variants.
npx "@rueda.dev/gems-diamond" add carousel Display
6 variants01 / 05
02 / 05
03 / 05
04 / 05
05 / 05
dots01 / 05
02 / 05
03 / 05
04 / 05
05 / 05
arrows01 / 05
02 / 05
03 / 05
04 / 05
05 / 05
thumbsIt shipped the way we hoped.
A calm, considered toolkit.
Finally, something that fits.
Built for makers, not committees.
Quiet, considered, alive.
cardscircular01 / 05Autoplay 3s
01 / 05
02 / 05
03 / 05
04 / 05
05 / 05
progressUsage Guide
How to wire up this component in your app — props, callbacks, customization, and the conventions Diamond shares across the library.
Navigation
- Click arrows (variant
arrows), dots (variantsdots/cards), or thumbnails / circular swatches to jump to any slide. - Drag / swipe works on mouse and touch on all transform-based variants. Disable with
draggable={false}; tweak the commit distance withdragThreshold. - Keyboard — left/right arrow keys when the carousel root has focus. Disable with
keyboard={false}.
Autoplay
autoplay={ms} advances every N ms. The interval pauses automatically while the pointer is over the carousel and while the user is dragging. Disable hover-pause with pauseOnHover={false}.
Layout
| Prop | Type | Description |
|---|---|---|
slidesPerView | number | Default 1 (most variants), 2.4 on cards for a 'peek' of the next slide. |
loop | boolean | Default true. When false, the first/last arrows render disabled at the edge. |
aspect | CSS aspect-ratio | Default '16 / 9'. Ignored on cards (slides keep their intrinsic height). |
gap | number (px) | Space between slides. Default 8. |
Controlled current slide
const [i, setI] = useState(0);
<Carousel
variant="arrows"
index={i}
onIndexChange={setI}
slides={slides}
/>Universal patterns
Every Diamond component shares the same prop conventions, so once you learn one you can predict the others.
variant— discriminated union of every visual option. Categories shown above are docs-only metadata; the prop is a flat string union.accent— any CSS color string. Overrides--diamond-accentjust for that instance via inlinestyle. Cascades into hover, ring, and selection states.asChild(when present) — renders the underlying primitive via@radix-ui/react-slot, letting you compose with<Link>,motion.button, etc.className— merged with internal Tailwind classes viacn(). Use it to override layout, spacing, or colors.- Native HTML attributes (
onClick,aria-*,data-*,ref, etc.) flow through to the root element without any whitelist. - Diamond is the skin: zero domain state, zero fetch, zero providers. You wire data and reactions in your app code; the components just render and emit events.