Carousel

Carousel is a component that displays multiple elements like a slideshow.

Usage

import { Carousel } from "@yamada-ui/react"
<Carousel.Root>
  <Carousel.List>
    <Carousel.Item />
  </Carousel.List>
  <Carousel.PrevTrigger />
  <Carousel.NextTrigger />
  <Carousel.Indicators>
    <Carousel.Indicator />
  </Carousel.Indicators>
</Carousel.Root>

Change Size

Change Color Scheme

Change Direction

To change the direction, set orientation to "horizontal" or "vertical". By default, "horizontal" is set.

Select the default slide

To select the default slide, set defaultIndex to the index.

Adjust the space between slides

To adjust the space between slides, set gap to a string or a number. By default, 1rem is set.

Change the duration of slide transition

To change the duration of slide transition, set duration to a number. By default, 25 is set.

Change the size of the slides

To change the size of the slides, set slideSize to a string or a number. By default, 100% is set.

If you want to change the size of individual slides, set the value to slideSize of Carousel.Item.

Change the alignment of the slides

To change the alignment of the slides, set align to "start", "center", "end", or a number. By default, "center" is set.

Change the number of slides to scroll

To change the number of slides to scroll, set slidesToScroll to a number. By default, 1 is set.

Use autoplay

To use autoplay, set autoplay to true.

Change the autoplay interval

To change the autoplay interval, set delay to a number (milliseconds). By default, 4000 is set.

Do not stop autoplay on mouse enter

By default, autoplay stops when the element is hovered over. To prevent this, set stopMouseEnterAutoplay to false.

Use Drag-Free

To use drag-free, set dragFree to true.

Disable looping

To disable looping, set loop to false.

Disable dragging

To disable dragging, set draggable to false.

Customize control buttons

To customize control buttons, set props to Carousel.PrevTrigger or Carousel.NextTrigger.

Customize indicators

To customize indicators, set props to Carousel.Indicators.

Handle Events

If you want to handle events such as user drag, use watchDrag.

Control

State

Ref

You can access the current scroll amount using onScrollProgress.

Props

Accessibility

Currently, this section is being updated due to the migration of v2.