Go Main page
Go Main page

Web components

cover

components

Carousel

v.1.0.0 | Saturn

Usage

1
import { Carousel } from '@kubit-ui-web/react-components';

Props

Let's delve into the versatility of the carousel component by examining all its avalaible props.

Carousel UnControlled

PropertyDescriptionTypeDefault
variant
Required
VariantString-
elements
Required
Slides to showJSX.Element-
pageControlVariantPagination variantString-
pageControlArrowsControlVariantPagination arrows control variantString-
defaultPageDefault open pageNumber0
numElementsPerPageNumber of elements per pageNumber-
numElementsToSlideNumber of elements to slideNumber-
onePageAlignWhen items fill in one page, align of the containerCarouselAlignTypeCENTER
onPageChangeFunction called when page changes(page: Number) => void-
circularWhen circular, after last page it will return to the firstBooleantrue
centerModeWhen center mode, and elements.length is odd, highlight the center elemenent of the caruselBooleanfalse
extraPaddingAdd extra padding (px) to the container to view beyond the limits of the carousel viewNumber-
extraPaddingAsArrowAllow extra padding to behave like an arrow. It should be used in mobileBooleantrue
leftArrowLeft arrow iconIElementOrIcon-
rightArrowRight arrow iconIElementOrIcon-
hasPaginationShow or not the pagination componentBooleantrue
onTransitionInforms when the component is on transitionfunction-
dataTestIdTest idString-
displayArrowsOnCarouselShow the arrows on the carousel or on the Page ControlBooleantrue
disableSwipeDisable or not the swipe actionBooleanfalse
pageControlAutomateConfigConfiguration for PageControlAutomatePageControlAutomateConfigType-
centerExtremesWhenExtraPaddingExtremes will be centered if extraPadding is usedBoolean-
ctvModify styles for the default version of the componentCarouselPropsStylesType-

Carousel Controlled

PropertyTypeDefaultDescription
variant
Required
String-Variant
elements
Required
JSX.Element-Slides to show
pageControlVariant
Required
String-Pagination variant
pageControlArrowsControlVariant
Required
String-Pagination arrows control variant
numPages
Required
Number-Number of pages
onKeyDown
Required
KeyboardEventHandler-onKeyDown callback
defaultPageNumber0Default open page
numElementsPerPageNumber-Number of elements per page
numElementsToSlideNumber-Number of elements to slide
onePageAlignCarouselAlignTypeCENTERWhen items fill in one page, align of the container
onPageChange(page: Number) => void-Function called when page changes
circularBooleantrueWhen circular, after last page it will return to the first
centerModeBooleanfalseWhen center mode, and elements.length is odd, highlight the center elemenent of the carusel
extraPaddingNumber-Add extra padding (px) to the container to view beyond the limits of the carousel view
extraPaddingAsArrowBooleantrueAllow extra padding to behave like an arrow. It should be used in mobile
leftArrowIElementOrIcon-Left arrow icon
rightArrowIElementOrIcon-Right arrow icon
hasPaginationBooleantrueShow or not the pagination component
onTransitionfunction-Informs when the component is on transition
dataTestIdString-Test id
displayArrowsOnCarouselBooleantrueShow the arrows on the carousel or on the Page Control
disableSwipeBooleanfalseDisable or not the swipe action
pageControlAutomateConfigPageControlAutomateConfigType-Configuration for PageControlAutomate
centerExtremesWhenExtraPaddingBoolean-Extremes will be centered if extraPadding is used
ctvCarouselPropsStylesType-Modify styles for the default version of the component
currentPageNumber-Current page
onMediaButtonClick(playing: Boolean, event?: React.MouseEvent ) => void-Function called when media button is clicked
onIndicatorChange(indexIndicator: Number) => void-Function to handle when indicator changes when using PageControlAutomate
onMouseOutMouseEventHandler-Function called when mouse is out
onMouseOverMouseEventHandler-Function called when mouse is over
playingBooleantrueBoolean to control PageControlAutomate
onLeftArrowClickMouseEventHandler-left arrow onClick callback
onRightArrowClickMouseEventHandler-right arrow onClick callback