GitHub

Carousel

An interactive slideshow for cycling through content.

Installation

Usage

Orientation

You can change the orientation of the carousel using the orientation prop.

Horizontal

Vertical

Thumbnail Indicators

Render each thumbnail inside <CarouselIndicator /> to create a visual preview of each slide.

Use the orientation prop to change the orientation of the thumbnail indicators.

Horizontal

Vertical

Examples

Autoplay

Use autoplay props on <Carousel /> to make the carousel play automatically.

Loop

Use the loop prop to make the carousel loop.

Controlled

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

Current page: 1 of 5

Slides Per Page

Display multiple slides simultaneously by setting the slidesPerPage prop on <Carousel />.

Spacing

Control the gap between slides using the spacing prop on <Carousel />.

Spacing is in multiples of 4px. Example: spacing={10} will set the spacing to 40px.

Padding

Control the padding around the carousel using the padding prop on <Carousel />.

Padding is in multiples of 4px. Example: padding={10} will set the padding to 40px.

Mouse Drag

To allow mouse drag, set the allowMouseDrag prop on <Carousel />.

API Reference

Root element of the carousel. Renders a div

CarouselContent

Container for carousel items. Renders a div

CarouselItem

Container for a single carousel item. Renders a div

CarouselControl

Container for carousel navigation controls. Renders a div

CarouselPrevious

Button that navigates to the previous slide. Renders a button

CarouselNext

Button that navigates to the next slide. Renders a button

CarouselIndicatorGroup

Container for carousel indicators. Renders a div

CarouselIndicator

Button that indicates and navigates to a specific slide. Renders a button


For a complete list of props, see the Ark UI documentation.