Ark Logo
Undefined
Components
Carousel

Carousel

A slideshow component that cycles through elements.

Anatomy

To set up the carousel correctly, you'll need to understand its anatomy and how we name its parts.

Each part includes a data-part attribute to help identify them in the DOM.

Examples

Learn how to use the Carousel component in your project. Let's take a look at the most basic example:

To create a controlled Carousel component, you can manage the state of the carousel using the index prop and update it when the onIndexChange event handler is called:

You can customize the Carousel component by setting various props. Here's an example of a customized Carousel:

Using the Root Provider

The RootProvider component provides a context for the carousel. It accepts the value of the useCarousel hook. You can leverage it to access the component state and methods from outside the carousel.

If you're using the RootProvider component, you don't need to use the Root component.

API Reference

Accessibility

Complies with the Carousel WAI-ARIA design pattern.