Skip to content
ContentInteractive playground

Carousel

Content you can browse slide by slide.

Preparing the playground…
Text and Markdown example
Carousel · Example
1<Carousel style={{width:320}} settings={{dots:true,infinite:false}}><CarouselContent>{["An idea", "A team", "A project"].map(title => <CarouselItem key={title}><Card style={{padding:48,textAlign:"center"}}>{title}</Card></CarouselItem>)}</CarouselContent><CarouselControls><CarouselPrevious aria-label="Previous" /><CarouselNext aria-label="Next" /></CarouselControls></Carousel>
Read documentation in Markdown

How to use it

Options come from react-slick. Use settings or opts and provide controls so navigation does not depend on gestures or autoplay.

Import

React / Next.js
1import { Carousel, CarouselContent, CarouselItem, CarouselControls, CarouselPrevious, CarouselNext, CarouselPlay, CarouselPause } from "@kivora/nextjs";

Interactive examples run inside a component with "use client". The playground's Copy button includes the imports needed for the current example.

API reference 0.2.0

Types from the installed published version, including component properties and common HTML attributes. “Optional” does not imply a default value; omitting a property lets the component decide.

PropertyTypeDescription
aria-labelstringAccessible name of the control.
childrenReactNodeContent or child elements of the component.
classNamestringAdditional CSS classes to customize the element.
defaultCheckedbooleanInitial selection of the control.
defaultValuestring | number | readonly string[]Initial value when the component manages its own state.
idstringElement identifier; associates labels and descriptions.
onClickMouseEventHandler<HTMLDivElement>Action performed when the element is activated.
onSubmitSubmitEventHandler<HTMLDivElement>Form submission event.
optsanyConfigures opts. The type describes the supported values and structure.
orientation"horizontal" | "vertical"Horizontal or vertical axis.
roleAriaRoleSemantic role of the element. Keep the default role unless a change is justified.
setApi((api: any) => void)Configures setApi. The type describes the supported values and structure.
settingsanyConfigures settings. The type describes the supported values and structure.
styleCSSPropertiesReact inline styles.
tabIndexnumberKeyboard focus order and availability.
titlestringTitle or supplementary information.

Subcomponents and composition

Review each component's properties and published declaration. Native and accessibility attributes are inherited from the element specified by its type.

Carousel16 properties
Carousel · TypeScript
1Carousel: React.ForwardRefExoticComponent<CarouselProps & React.RefAttributes<HTMLDivElement>>
CarouselContent2 properties
PropertyTypeDescription
childrenReactNodeContent or child elements of the component.
classNamestringAdditional CSS classes to customize the element.
CarouselContent · TypeScript
1declare function CarouselContent({ children }: CarouselContentProps): React.JSX.Element;
CarouselItem13 properties
PropertyTypeDescription
aria-labelstringAccessible name of the control.
childrenReactNodeContent or child elements of the component.
classNamestringAdditional CSS classes to customize the element.
defaultCheckedbooleanInitial selection of the control.
defaultValuestring | number | readonly string[]Initial value when the component manages its own state.
idstringElement identifier; associates labels and descriptions.
onChangeChangeEventHandler<HTMLDivElement, Element>Change event. Check the type: some controls return an object, others a DOM event.
onClickMouseEventHandler<HTMLDivElement>Action performed when the element is activated.
onSubmitSubmitEventHandler<HTMLDivElement>Form submission event.
roleAriaRoleSemantic role of the element. Keep the default role unless a change is justified.
styleCSSPropertiesReact inline styles.
tabIndexnumberKeyboard focus order and availability.
titlestringTitle or supplementary information.
CarouselItem · TypeScript
1CarouselItem: React.ForwardRefExoticComponent<CarouselItemProps & React.RefAttributes<HTMLDivElement>>
CarouselControls13 properties
PropertyTypeDescription
aria-labelstringAccessible name of the control.
childrenReactNodeContent or child elements of the component.
classNamestringAdditional CSS classes to customize the element.
defaultCheckedbooleanInitial selection of the control.
defaultValuestring | number | readonly string[]Initial value when the component manages its own state.
idstringElement identifier; associates labels and descriptions.
onChangeChangeEventHandler<HTMLDivElement, Element>Change event. Check the type: some controls return an object, others a DOM event.
onClickMouseEventHandler<HTMLDivElement>Action performed when the element is activated.
onSubmitSubmitEventHandler<HTMLDivElement>Form submission event.
roleAriaRoleSemantic role of the element. Keep the default role unless a change is justified.
styleCSSPropertiesReact inline styles.
tabIndexnumberKeyboard focus order and availability.
titlestringTitle or supplementary information.
CarouselControls · TypeScript
1CarouselControls: React.ForwardRefExoticComponent<CarouselControlsProps & React.RefAttributes<HTMLDivElement>>
CarouselPrevious20 properties
PropertyTypeDescription
aria-labelstringAccessible name of the control.
asChildbooleanApply props and behavior to a single compatible child element.
childrenReactNodeContent or child elements of the component.
classNamestringAdditional CSS classes to customize the element.
defaultCheckedbooleanInitial selection of the control.
defaultValuestring | number | readonly string[]Initial value when the component manages its own state.
disabledbooleanDisable interaction with the control.
idstringElement identifier; associates labels and descriptions.
namestringName used to identify the control in forms.
onChangeChangeEventHandler<HTMLButtonElement, Element>Change event. Check the type: some controls return an object, others a DOM event.
onClickMouseEventHandler<HTMLButtonElement>Action performed when the element is activated.
onSubmitSubmitEventHandler<HTMLButtonElement>Form submission event.
roleAriaRoleSemantic role of the element. Keep the default role unless a change is justified.
size"default" | "sm" | "lg" | "icon" | nullVisual size of the component.
styleCSSPropertiesReact inline styles.
tabIndexnumberKeyboard focus order and availability.
titlestringTitle or supplementary information.
type"button" | "submit" | "reset"Operation type or mode; values depend on the component.
valuestring | number | readonly string[]Controlled value. Update it from the change callback.
variant"default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | nullVisual variant. Use a value supported by this component.
CarouselPrevious · TypeScript
1CarouselPrevious: React.ForwardRefExoticComponent<Omit<ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>
CarouselNext20 properties
PropertyTypeDescription
aria-labelstringAccessible name of the control.
asChildbooleanApply props and behavior to a single compatible child element.
childrenReactNodeContent or child elements of the component.
classNamestringAdditional CSS classes to customize the element.
defaultCheckedbooleanInitial selection of the control.
defaultValuestring | number | readonly string[]Initial value when the component manages its own state.
disabledbooleanDisable interaction with the control.
idstringElement identifier; associates labels and descriptions.
namestringName used to identify the control in forms.
onChangeChangeEventHandler<HTMLButtonElement, Element>Change event. Check the type: some controls return an object, others a DOM event.
onClickMouseEventHandler<HTMLButtonElement>Action performed when the element is activated.
onSubmitSubmitEventHandler<HTMLButtonElement>Form submission event.
roleAriaRoleSemantic role of the element. Keep the default role unless a change is justified.
size"default" | "sm" | "lg" | "icon" | nullVisual size of the component.
styleCSSPropertiesReact inline styles.
tabIndexnumberKeyboard focus order and availability.
titlestringTitle or supplementary information.
type"button" | "submit" | "reset"Operation type or mode; values depend on the component.
valuestring | number | readonly string[]Controlled value. Update it from the change callback.
variant"default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | nullVisual variant. Use a value supported by this component.
CarouselNext · TypeScript
1CarouselNext: React.ForwardRefExoticComponent<Omit<ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>
CarouselPlay20 properties
PropertyTypeDescription
aria-labelstringAccessible name of the control.
asChildbooleanApply props and behavior to a single compatible child element.
childrenReactNodeContent or child elements of the component.
classNamestringAdditional CSS classes to customize the element.
defaultCheckedbooleanInitial selection of the control.
defaultValuestring | number | readonly string[]Initial value when the component manages its own state.
disabledbooleanDisable interaction with the control.
idstringElement identifier; associates labels and descriptions.
namestringName used to identify the control in forms.
onChangeChangeEventHandler<HTMLButtonElement, Element>Change event. Check the type: some controls return an object, others a DOM event.
onClickMouseEventHandler<HTMLButtonElement>Action performed when the element is activated.
onSubmitSubmitEventHandler<HTMLButtonElement>Form submission event.
roleAriaRoleSemantic role of the element. Keep the default role unless a change is justified.
size"default" | "sm" | "lg" | "icon" | nullVisual size of the component.
styleCSSPropertiesReact inline styles.
tabIndexnumberKeyboard focus order and availability.
titlestringTitle or supplementary information.
type"button" | "submit" | "reset"Operation type or mode; values depend on the component.
valuestring | number | readonly string[]Controlled value. Update it from the change callback.
variant"default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | nullVisual variant. Use a value supported by this component.
CarouselPlay · TypeScript
1CarouselPlay: React.ForwardRefExoticComponent<Omit<ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>
CarouselPause20 properties
PropertyTypeDescription
aria-labelstringAccessible name of the control.
asChildbooleanApply props and behavior to a single compatible child element.
childrenReactNodeContent or child elements of the component.
classNamestringAdditional CSS classes to customize the element.
defaultCheckedbooleanInitial selection of the control.
defaultValuestring | number | readonly string[]Initial value when the component manages its own state.
disabledbooleanDisable interaction with the control.
idstringElement identifier; associates labels and descriptions.
namestringName used to identify the control in forms.
onChangeChangeEventHandler<HTMLButtonElement, Element>Change event. Check the type: some controls return an object, others a DOM event.
onClickMouseEventHandler<HTMLButtonElement>Action performed when the element is activated.
onSubmitSubmitEventHandler<HTMLButtonElement>Form submission event.
roleAriaRoleSemantic role of the element. Keep the default role unless a change is justified.
size"default" | "sm" | "lg" | "icon" | nullVisual size of the component.
styleCSSPropertiesReact inline styles.
tabIndexnumberKeyboard focus order and availability.
titlestringTitle or supplementary information.
type"button" | "submit" | "reset"Operation type or mode; values depend on the component.
valuestring | number | readonly string[]Controlled value. Update it from the change callback.
variant"default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | nullVisual variant. Use a value supported by this component.
CarouselPause · TypeScript
1CarouselPause: React.ForwardRefExoticComponent<Omit<ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>
API generated from @kivora/nextjs 0.2.0View package