Motion UIComponentsComponent

Carousel controls

Prev and next buttons with animated position dots for any paged carousel.

npx shadcn@latest add @motion/carousel-controls

API reference

Components

<ArrowIcon />

Inline chevron used by StepButton.

direction

ArrowDirection

Which way the chevron points. "prev" mirrors it horizontally.

className?

string

Merged onto the <svg> element.

<StepButton />

Bordered icon button with theme snap tap press.

direction

ArrowDirection

Which control this is.

onClick

() => void

Fired on click.

label

string

Accessible label for the icon-only button.

children?

ReactNode

Override the icon.

disabled?

boolean

Disable the button.

className?

string

Merged onto the button element.

<PositionDots />

Position indicator with one mark per slide.

index

number

Index of the active slide (0-based).

total

number

Total number of slides.

variant?

PositionDotsVariant = "bar"

Active-dot visual style. Defaults to "bar".

onSelect?

(index: number) => void

Makes each dot a selectable tab.

label?

string = "Choose a slide"

aria-label for the tablist when onSelect is set.

className?

string

Merged onto the track element.

<CarouselControls />

Assembled control strip: prev button, dots, next button.

index

number

Index of the active slide (0-based).

total

number

Total number of slides.

onPrev

() => void

Step to the previous slide.

onNext

() => void

Step to the next slide.

onSelect?

(index: number) => void

Makes dots selectable and calls onSelect(i) on click.

dots?

PositionDotsVariant = "bar"

Dot indicator style. Defaults to "bar".

prevLabel?

string = "Previous slide"

Accessible label for the previous button.

nextLabel?

string = "Next slide"

Accessible label for the next button.

dotsLabel?

string = "Choose a slide"

aria-label for the dots tablist.

announcement?

string

Text announced in an aria-live region.

className?

string

Merged onto the control-strip root.