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>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.
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
id | string | Element identifier; associates labels and descriptions. |
onClick | MouseEventHandler<HTMLDivElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLDivElement> | Form submission event. |
opts | any | Configures opts. The type describes the supported values and structure. |
orientation | "horizontal" | "vertical" | Horizontal or vertical axis. |
role | AriaRole | Semantic 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. |
settings | any | Configures settings. The type describes the supported values and structure. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title 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
| Property | Type | Description |
|---|---|---|
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
CarouselContent · TypeScript
1declare function CarouselContent({ children }: CarouselContentProps): React.JSX.Element;CarouselItem13 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
id | string | Element identifier; associates labels and descriptions. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLDivElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLDivElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
CarouselItem · TypeScript
1CarouselItem: React.ForwardRefExoticComponent<CarouselItemProps & React.RefAttributes<HTMLDivElement>>CarouselControls13 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
id | string | Element identifier; associates labels and descriptions. |
onChange | ChangeEventHandler<HTMLDivElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLDivElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLDivElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
CarouselControls · TypeScript
1CarouselControls: React.ForwardRefExoticComponent<CarouselControlsProps & React.RefAttributes<HTMLDivElement>>CarouselPrevious20 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
disabled | boolean | Disable interaction with the control. |
id | string | Element identifier; associates labels and descriptions. |
name | string | Name used to identify the control in forms. |
onChange | ChangeEventHandler<HTMLButtonElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLButtonElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLButtonElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
size | "default" | "sm" | "lg" | "icon" | null | Visual size of the component. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
type | "button" | "submit" | "reset" | Operation type or mode; values depend on the component. |
value | string | number | readonly string[] | Controlled value. Update it from the change callback. |
variant | "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | Visual variant. Use a value supported by this component. |
CarouselPrevious · TypeScript
1CarouselPrevious: React.ForwardRefExoticComponent<Omit<ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>CarouselNext20 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
disabled | boolean | Disable interaction with the control. |
id | string | Element identifier; associates labels and descriptions. |
name | string | Name used to identify the control in forms. |
onChange | ChangeEventHandler<HTMLButtonElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLButtonElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLButtonElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
size | "default" | "sm" | "lg" | "icon" | null | Visual size of the component. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
type | "button" | "submit" | "reset" | Operation type or mode; values depend on the component. |
value | string | number | readonly string[] | Controlled value. Update it from the change callback. |
variant | "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | Visual variant. Use a value supported by this component. |
CarouselNext · TypeScript
1CarouselNext: React.ForwardRefExoticComponent<Omit<ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>CarouselPlay20 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
disabled | boolean | Disable interaction with the control. |
id | string | Element identifier; associates labels and descriptions. |
name | string | Name used to identify the control in forms. |
onChange | ChangeEventHandler<HTMLButtonElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLButtonElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLButtonElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
size | "default" | "sm" | "lg" | "icon" | null | Visual size of the component. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
type | "button" | "submit" | "reset" | Operation type or mode; values depend on the component. |
value | string | number | readonly string[] | Controlled value. Update it from the change callback. |
variant | "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | Visual variant. Use a value supported by this component. |
CarouselPlay · TypeScript
1CarouselPlay: React.ForwardRefExoticComponent<Omit<ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>CarouselPause20 properties
| Property | Type | Description |
|---|---|---|
aria-label | string | Accessible name of the control. |
asChild | boolean | Apply props and behavior to a single compatible child element. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
disabled | boolean | Disable interaction with the control. |
id | string | Element identifier; associates labels and descriptions. |
name | string | Name used to identify the control in forms. |
onChange | ChangeEventHandler<HTMLButtonElement, Element> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLButtonElement> | Action performed when the element is activated. |
onSubmit | SubmitEventHandler<HTMLButtonElement> | Form submission event. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
size | "default" | "sm" | "lg" | "icon" | null | Visual size of the component. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
type | "button" | "submit" | "reset" | Operation type or mode; values depend on the component. |
value | string | number | readonly string[] | Controlled value. Update it from the change callback. |
variant | "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | Visual 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