Skip to content
GitHub (opens in a new tab)

Carousel

Paged track of slides with prev/next kit Buttons. One piece.

stableOrganismcontracts/carousel.json

Preview

Carousel

Swipe through slides. Prev and next are kit Buttons. Not Content, Item, Previous, or Next cousins.

Five slides labeled 1 to 5, horizontal, with the Slide N of M caption. Variants shows three-up and loop.

1
2
3
4
5

Slide 1 of 5

Usage

One full slide at a time. Arrows sit outside the track.

Do's

  • galleries
  • featured cards
  • paged media

Don'ts

  • Tabs for views
  • Pagination for lists
  • don't use for primary nav
  • overflow row of cards/chips — use Conveyor
<Carousel
  items={[panel, panel, panel, panel, panel]}
  showIndex
/>
  • galleries
  • featured cards
  • paged media
  • Tabs for views
  • Pagination for lists
  • don't use for primary nav
  • overflow row of cards/chips — use Conveyor
import { Carousel } from "agentic-ds-kit";
must
  • region with aria-roledescription=carousel
  • slides are role=group with aria-roledescription=slide
  • button names Previous slide / Next slide
  • index live region if shown
  • built-in labels (previousSlide, nextSlide, slide) come from KitLabelsProvider; English by default
defaults
  • orientation horizontal
  • loop false
  • align start
  • slidesPerView 1
  • showControls true
  • showIndex false
  • ariaLabel Carousel
stops if
  • no CarouselContent/Item/Previous/Next
  • do not use raw hex
  • compose kit Button for controls
  • no autoplay in v1

From contracts/carousel.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

NameTypeRequiredDefaultNotes
itemsarrayYes—ReactNode slides. No CarouselCard or Slide cousins.
orientationhorizontal | verticalNohorizontal—
loopbooleanNofalse—
alignstart | centerNostart—
slidesPerViewenumNo11 = full slide; 3 = one-third; 4 = quarter.
showControlsbooleanNotrue—
showIndexbooleanNofalseCaption under the track: Slide N of M, aria-live polite
onIndexChangefunctionNo—(index: number) => void // 0-based
ariaLabelstringNoCarousel—
  • Component
    →

    Tabs

    Switch between related views in place.

  • Component
    →

    Pagination

    Page navigation with previous, next, page numbers, and ellipsis, plus optional first/last, a rows-per-page Select and a page or results status for table footers.

  • Component
    →

    Conveyor

    Arrows at both ends of a row or column that is too long to fit, so people can move it along without a scrollbar.