Ark Logo
Undefined
Components
Carousel

Carousel

An interactive slideshow component for cycling through elements.

Features

  • Native CSS Scroll Snap integration for smooth, performant animations
  • Flexible orientation support (horizontal and vertical layouts)
  • Customizable slide alignment (start, center, or end positions)
  • Multi-slide display capabilities for complex layouts
  • Automatic playback with configurable looping behavior
  • Adjustable slide spacing and gap controls

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:

Autoplay

The Carousel can play automatically. Just add the autoplay prop. You'll probably want to add loop too, so it keeps going after the last slide.

Using the Root Provider

The RootProvider sets up carousel context using the useCarousel hook, enabling external access to its state and methods.

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.