Skip to content
75NeoUI

component · vue

Carousel

A looping, autoplaying slideshow with keyboard, drag and indicator navigation, wrapping Ark UI.

carousel

Slides are data, like accordion rows. Pass items and the carousel renders the viewport, the arrows and the indicator dots.

<Carousel
  items={[
    { id: "one", content: "First" },
    { id: "two", content: "Second" },
  ]}
  loop
  autoplay={{ delay: 4000 }}
/>
<Carousel
  :items="[
    { id: 'one', content: 'First' },
    { id: 'two', content: 'Second' },
  ]"
  loop
  :autoplay="{ delay: 4000 }"
/>

slidesPerPage shows several slides at once and spacing is the gap between them, as a CSS length. allowMouseDrag lets the pointer drag the track, which touch does anyway.

The current page

React and Vue spell a controlled value too differently to share one type, so this prop lives outside the shared contract. React takes Ark UI’s page, defaultPage and onPageChange. Vue takes v-model:page, with defaultPage as the uncontrolled counterpart.

<Carousel items={items} page={page} onPageChange={({ page }) => setPage(page)} />
<Carousel :items="items" v-model:page="page" />

Arbitrary markup in a slide

content on an item is text. For anything else use renderItem in React or the item slot in Vue, both of which receive the item and its index.

Slots

The same word names the recipe slot, the data-slot attribute and the key in ui.

  • base
  • controls
  • viewport
  • item
  • prev
  • next
  • dots
  • dot

Props

Taken by both adapters, read out of the component module. The same names and the same types work in React and Vue.

Vue only

Binds v-model:page.

#item

{ item: CarouselItem; index: number }

Replace a slide's content. Falls back to `item.content`.