Scroll Area

A container with a customizable scrollbar for scrollable content.

Installation

Import the component from the passport-ui package.

components/example.tsx
1
2
import { ScrollArea } 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
<div className="w-sm">
<ScrollArea className="h-48 rounded-md border">
<div className="list-container p-4">
{Array.from({ length: 20 }, (_, i) => (
<Card key={i}>
<CardContent>
<div className="meta-container">
<h3>Item {i + 1}</h3>
<p>
This is item number {i + 1} in the scrollable list. The
scroll area allows for smooth scrolling through content that
exceeds the container height.
</p>
</div>
</CardContent>
</Card>
))}
</div>
</ScrollArea>
</div>
{/* Simple text scrolling */}
<ScrollArea className="h-32 w-48 rounded border p-4">
<div className="space-y-2">
{Array.from({ length: 50 }, (_, i) => (
<p key={i}>Line {i + 1}</p>
))}
</div>
</ScrollArea>

Additional resources

Documentation and examples are available in Storybook.