Carousel
A card carousel you can drag, fling, scroll sideways or step through with keys, with five transitions, three indicators, arrows, loop and autoplay.
pixikit.com/docs/components/carousel
Customize
Base width300px
Aspect ratio1.25
Peek0px
Gap16px
Radius12px
Frame
Effect
Indicator
Arrows
Autoplay
Autoplay delay3000ms
Pause on hover
Loop
Draggable
Round
Initial index0
Theme
Props
21| Name | Type | Default | Description |
|---|---|---|---|
items | (CarouselItem | string | ReactNode)[] | DEFAULT_ITEMS | The cards. Objects get the built-in card, strings are image URLs and React elements render as they are. |
baseWidth | number | string | 300 | The carousel's width in pixels, or any CSS width. It never grows past its container. |
aspectRatio | number | 1.25 | A card's width divided by its height. |
peek | number | 0 | Space on each side of the active card where its neighbours show, in pixels. |
gap | number | 16 | Space between cards, in pixels. |
radius | number | 12 | Corner radius of the cards, in pixels. |
frame | boolean | true | Holds the cards and controls in a panel that masks them as they slide out. Without it the cards fade at the edges. |
effect | "tilt" | "slide" | "scale" | "fade" | "cube" | "tilt" | How the cards move from one to the next. |
indicator | "dots" | "bars" | "counter" | "none" | "dots" | The navigation under the cards. Bars fill with the autoplay timer. |
arrows | boolean | false | Shows previous and next buttons. |
autoplay | boolean | false | Moves to the next card on a timer. |
autoplayDelay | number | 3000 | Time on each card while autoplay is on, in milliseconds. |
pauseOnHover | boolean | false | Holds the autoplay while the pointer or keyboard focus is on the carousel. |
loop | boolean | false | Wraps from the last card to the first and back. |
draggable | boolean | true | Lets people drag, swipe or scroll sideways through the cards. |
round | boolean | false | Turns the cards into circles. |
initialIndex | number | 0 | The card shown first, counting from 0. |
theme | "dark" | "light" | "dark" | Color scheme of the cards, frame and controls. |
onChange | (index: number) => void | None | Called with the index of the new card whenever it changes. |
className | string | None | |
style | CSSProperties | None |