Skip to content
Rich Content

Carousel

client51 kB
/carouselCarouselProps

Preview

Props

19
PropTypeDefault

align

CarouselAlign"start"

axis

"x" | "y""x"

className

string

defaultIndex

number0

dragFree

booleanfalse

empty

ReactNode

gap

"xs" | "sm" | "md" | "lg" | "none""sm"

getKey

required
(item: T, index: number) => string

index

number

items

required
readonly T[]

label

string

labels

Partial<CarouselLabels>

loop

booleanfalse

onIndexChange

((index: number) => void)

renderItem

required
(item: T, index: number) => ReactNode

slideSize

string | number"100%"

slidesToScroll

number1

withControls

booleantrue

withIndicators

booleanfalse

Slot props

7

Each one spreads over an inner element, so you can restyle a region without forking the component.

PropTypeDefault

controlsProps

The control bar. Not rendered without `withControls` or `withIndicators`.

BoxSlotProps

emptyProps

The empty-carousel notice. Only rendered with no `items` and with `empty`.

TextSlotProps

indicatorProps

Every indicator. It spreads over ALL of them; the active one carries `aria-current`.

Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">

indicatorsProps

The indicator list. Only with `withIndicators`.

Omit<DetailedHTMLProps<HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">

nextProps

The next button. Only with `withControls`; its `disabled` comes from whether anything is left ahead.

ActionIconProps

previousProps

The previous button. Only with `withControls`; its `disabled` comes from whether anything is left behind.

ActionIconProps

slideProps

Every slide. It spreads over ALL of them: they arrive through `items`, not through composition. Their width comes from `slideSize`, so pinning it here throws off the embla drag.

BoxSlotProps

Also accepts

On top of its own props, this component forwards these groups.

Style props · 126