@usevyre/react @usevyre/vue

Carousel

An accessible content slider for galleries, onboarding, and testimonials. Controlled by a 0-based index; compose CarouselSlide children. Snap scrolling, clickable dots, prev/next arrows, / keyboard, optional loop 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

Prop Type Default Description
value number Controlled active slide (0-based). Omit for uncontrolled.
defaultValue number 0 Initial slide when uncontrolled.
onChange (index: number) => void Emits the new slide index. Not an event.
loop boolean false Wrap past the first/last slide.
autoPlay boolean false Advance automatically; pauses on hover/focus.
interval number 5000 Autoplay interval in ms.
showArrows boolean true Show prev/next arrow buttons.
showIndicators boolean true Show 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.