Introducing PrimeReact v11-alpha 🎉Discover Now

Carousel

Carousel is a content slider featuring various customization options.

Last Played
Velvet Haze
Velvet Haze
Aurora Skies
Dissolve
Dissolve
Phantom Echo
Still Life
Still Life
Glass Animals
Bloom
Bloom
Petal Storm
Refraction
Refraction
Prism Collective
Ivory
Ivory
Soft Landing
preview

Installation#

npx shadcn@latest add @primereact/carousel

Usage#

import { Carousel, CarouselContent, CarouselIndicators, CarouselItem, CarouselNext, CarouselPrev } from '@/components/ui/carousel';
<Carousel>
    <CarouselContent>
        <CarouselItem>...</CarouselItem>
    </CarouselContent>
    <CarouselIndicators />
    <CarouselPrev />
    <CarouselNext />
</Carousel>

Examples#

Basic#

1
2
3
4
5
basic-demo

Alignment#

Use the align property to align the carousel items. slidesPerPage property is used to control the number of slides visible per page.

1
2
3
4
5
alignment-demo

Orientation#

Use the orientation property to change the orientation of the carousel.

1
2
3
4
5
orientation-demo

Loop#

Use the loop property to enable loop mode.

1
2
3
4
5
loop-demo

Variable Size#

Use the autoSize property to enable auto size mode and set the width of the carousel items.

1
2
3
4
5
6
7
8
variable-size-demo

Gallery demo shows how to use the slide property to scroll to a specific slide by index.

Image 1
Image 2
Image 3
Image 4
Image 5
Image 6
Image 7
Image 8
Image 9
Image 1
Image 2
Image 3
Image 4
Image 5
Image 6
Image 7
Image 8
Image 9
gallery-demo