A shadcn-style carousel component built with Ark UI primitives.

Installation

npx shadcn@latest add @ark-cn/carousel

Usage

import * as Carousel from "@/components/ui/carousel"

Read exported parts in src/components/ui/carousel.tsx and compose the primitive according to the Ark UI pattern for this component.

Examples

Autoplay with controls

Controlled page

Page 1 of 5

Pause on hover

Autoplay: playing

Scroll to specific slide

Dynamic slides

Slides per page

Custom spacing

spacing="48px"

Variable size items

Thumbnail indicators

API reference

This component mirrors the upstream Ark UI primitive. All props and DOM behavior are defined by Ark unless you see an ark-cn-only row below.

CarouselPrevious

PropTypeDescription
variant?ButtonVariantButton style preset (default outline).
size?ButtonSizeButton size (default icon-sm).
anchorButtons?booleanPositions the control as a floating anchored button outside the carousel.

CarouselNext

PropTypeDescription
variant?ButtonVariantButton style preset (default outline).
size?ButtonSizeButton size (default icon-sm).
anchorButtons?booleanPositions the control as a floating anchored button outside the carousel.

CarouselAutoplay

PropTypeDescription
variant?ButtonVariantButton style preset (default outline).
size?ButtonSizeButton size (default icon-sm).

See the ARK UI documentation for the full API.

Accessibility

See the Ark UI documentation for clarification.