@usevyre/react@usevyre/vue

Carousel

An accessible content slider for galleries, onboarding, and testimonials. Controlled by a 0-based index; composeCarouselSlide children. Snap scrolling, clickable dots, prev/next arrows, / keyboard, optionalloop and autoPlay (which pauses on hover/focus).


Gallery with loop

Drag/scroll, click a dot, use the arrows, or focus the track and press/. With loop, the ends wrap.

Slide 1 of 3

import { useState } from "react";
import { Carousel, CarouselSlide } from "@usevyre/react";

const [i, setI] = useState(0);

<Carousel value={i} onChange={setI} loop>
  <CarouselSlide>
    <img src="/welcome.jpg" alt="Welcome" />
  </CarouselSlide>
  <CarouselSlide>
    <img src="/compose.jpg" alt="Compose" />
  </CarouselSlide>
  <CarouselSlide>
    <img src="/ship.jpg" alt="Ship" />
  </CarouselSlide>
</Carousel>

Props

Props

PropTypeDefaultDescription
valuenumberControlled active slide (0-based). Omit for uncontrolled.
defaultValuenumber0Initial slide when uncontrolled.
onChange(index: number) => voidEmits the new slide index. Not an event.
loopbooleanfalseWrap past the first/last slide.
autoPlaybooleanfalseAdvance automatically; pauses on hover/focus.
intervalnumber5000Autoplay interval in ms.
showArrowsbooleantrueShow prev/next arrow buttons.
showIndicatorsbooleantrueShow clickable dot indicators.
Slides must be CarouselSlide. Snap, indices, and ARIA roles depend on it — so AI can’t produce a broken slider from raw divs.