Carousel

A slideshow component for cycling through images or content.

Installation

Import the component from the passport-ui package.

components/example.tsx
1
2
3
4
5
6
7
8
import {
Carousel,
CarouselContent,
CarouselItem,
CarouselNext,
CarouselPrevious,
} from "passport-ui";
import { Card, CardContent } from "passport-ui";

Usage

Basic example showing how to use the component.

components/example.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<div className="w-sm">
<Carousel orientation="horizontal">
<CarouselContent>
{Array.from({ length: 5 }).map((_, index) => (
<CarouselItem key={index}>
<Card>
<CardContent>
<div className="meta-container">
<h3>Slide {index + 1}</h3>
<p>Move using buttons</p>
</div>
</CardContent>
</Card>
</CarouselItem>
))}
</CarouselContent>
<CarouselPrevious />
<CarouselNext />
</Carousel>
</div>
{/* Vertical carousel */}
<div className="w-sm">
<Carousel orientation="vertical">
<CarouselContent className="h-24">
{Array.from({ length: 3 }).map((_, index) => (
<CarouselItem key={index}>
<Card>
<CardContent>
<h3>Slide {index + 1}</h3>
</CardContent>
</Card>
</CarouselItem>
))}
</CarouselContent>
<CarouselPrevious />
<CarouselNext />
</Carousel>
</div>

Additional resources

Documentation and examples are available in Storybook.