Skip to Content
Documentation
Getting startedComponentsChartsTheming
Get Pro
Overview
Concepts

Carousel

Used to cycle through a series of visual content within a container

Recipe

Anatomy

import { Carousel } from '@chakra-ui/react'
<Carousel.Root>
  <Carousel.ItemGroup>
    <Carousel.Item />
  </Carousel.ItemGroup>
  <Carousel.Control>
    <Carousel.AutoplayTrigger>
      <Carousel.AutoplayIndicator />
    </Carousel.AutoplayTrigger>
    <Carousel.PrevTrigger />
    <Carousel.Indicators />
    <Carousel.NextTrigger />
    <Carousel.ProgressText />
  </Carousel.Control>
</Carousel.Root>

Examples

Controlled

Use the page and onPageChange props to programmatically control the active carousel page.

Arrows

Use the Carousel.PrevTrigger and Carousel.NextTrigger components to create arrows that navigate between slides.

Indicators

Use the Carousel.Indicators component to render visual indicators that help users track the progress of the carousel and jump to specific slides.

It's a shortcut that renders a full set of indicators based on the number of slides, so you don't have to map over them yourself.

<Carousel.IndicatorGroup>
  {Array.from({ length: items.length }, (_, index) => (
    <Carousel.Indicator key={index} index={index} />
  ))}
</Carousel.IndicatorGroup>

Use Carousel.IndicatorGroup and Carousel.Indicator directly when you need to customize each indicator.

Spacing

Use the spacing prop to control the spacing between slides.

Vertical

Set the orientation prop to vertical to transform your carousel into a vertical slider.

Autoplay

Pass the autoplay prop to the Carousel.Root component to make the carousel automatically move between slides.

Images

Here's an example that shows how to create an image carousel for a product showcase.

Props

Root

PropDefaultType
slideCount *
number

The total number of slides. Useful for SSR to render the initial ating the snap points.

allowMouseDrag false
boolean

Whether to allow scrolling via dragging with mouse

autoplay false
boolean | { delay: number }

Whether to scroll automatically. The default delay is 4000ms.

autoSize false
boolean

Whether to enable variable width slides.

defaultPage '0'
number

The initial page to scroll to when rendered. Use when you don't need to control the page of the carousel.

inViewThreshold '0.6'
number | number[]

The threshold for determining if an item is in view.

loop false
boolean

Whether the carousel should loop around.

orientation '\'horizontal\''
'horizontal' | 'vertical'

The orientation of the element.

slidesPerMove '\'auto\''
number | 'auto'

The number of slides to scroll at a time. When set to `auto`, the number of slides to scroll is determined by the `slidesPerPage` property.

slidesPerPage '1'
number

The number of slides to show at a time.

snapType '\'mandatory\''
'proximity' | 'mandatory'

The snap type of the item.

spacing '\'0px\''
string

The amount of space between items.

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.
ids
Partial<{ root: string item: (index: number) => string itemGroup: string nextTrigger: string prevTrigger: string indicatorGroup: string indicator: (index: number) => string }>

The ids of the elements in the carousel. Useful for composition.

onAutoplayStatusChange
(details: AutoplayStatusDetails) => void

Function called when the autoplay status changes.

onDragStatusChange
(details: DragStatusDetails) => void

Function called when the drag status changes.

onPageChange
(details: PageChangeDetails) => void

Function called when the page changes.

padding
string

Defines the extra space added around the scrollable area, enabling nearby items to remain partially in view.

page
number

The controlled page of the carousel.

translations
IntlTranslations

The localized messages to use.

ItemGroup

PropDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.

Item

PropDefaultType
index *
number

The index of the item.

snapAlign '\'start\''
'center' | 'start' | 'end'

The snap alignment of the item.

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.

Control

PropDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.