Diamond Diamond

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
§01

Display

6 variants
01 / 05
02 / 05
03 / 05
04 / 05
05 / 05
dots
01 / 05
02 / 05
03 / 05
04 / 05
05 / 05
arrows
01 / 05
02 / 05
03 / 05
04 / 05
05 / 05
thumbs
It shipped the way we hoped.
A calm, considered toolkit.
Finally, something that fits.
Built for makers, not committees.
Quiet, considered, alive.
cards
circular
01 / 05Autoplay 3s
01 / 05
02 / 05
03 / 05
04 / 05
05 / 05
progress

Usage 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 (variants dots / 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 with dragThreshold.
  • 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

PropTypeDescription
slidesPerViewnumberDefault 1 (most variants), 2.4 on cards for a 'peek' of the next slide.
loopbooleanDefault true. When false, the first/last arrows render disabled at the edge.
aspectCSS aspect-ratioDefault '16 / 9'. Ignored on cards (slides keep their intrinsic height).
gapnumber (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-accent just for that instance via inline style. 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 via cn(). 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.