Displays a carousel with previous and next buttons. Based on Embla Carousel.
Embla Carousel Options Embla Carousel Plugins
Import
Usage
Simple
A simple carousel with images and some spacing between them.
Vertical
You can change the orientation of the carousel by using the axis
option.
Autoplay
You can set the carousel to autoplay by using the Autoplay
plugin. First, install the embla-carousel-autoplay
package.
Then, import the plugin.
Fade
You can set the carousel to fade by using the Fade
plugin.
Then, import the plugin.
Navigation Arrows
You can add navigation arrows to the carousel by using the Carousel.Previous
and Carousel.Next
components.
Navigation Dots
You can add navigation dots to the carousel by using the Carousel.Dots
component.
Custom Dots
You can customize the navigation dots by using the Carousel.Dots
component and passing a render function.
Multiple Slides
You can display multiple slides at once by setting the slidesToScroll
option. You also need to set the flex basis of the slides to a percentage value.
Props
- options?
-
EmblaOptionsType
Options for the carousel. See the Embla Carousel documentation link above for more information.
- plugins?
-
EmblaPluginType[]
Plugins for the carousel. See the Embla Carousel documentation link above for more information.
- getCarouselApi?
-
(api: CarouselAPI) => void;
A function that receives the Embla Carousel API instance. Useful for controlling the carousel programmatically.
API Interface: CarouselProps
API Interface: CarouselContainerProps
API Interface: CarouselNextProps
API Interface: CarouselPreviousProps
API Interface: CarouselSlideProps
- as?
-
IconType
The element type to render the dots as.
- render?
-
(slideIndex: number, currentIndex: number) => ReactNode
A function that returns a ReactNode for each dot. The selected index and current slide index is passed as arguments.
API Interface: CarouselDotsProps