Display
Scroll area
A scrolling region with a thin custom scrollbar that shows on hover, on Base UI ScrollArea.
packages/design-system/components/ui/scroll-area.tsx
Examples
Anatomy
- 01Root, relative
- 02Viewport
- 03Scrollbar and thumb
- 04Corner
Usage
import { ScrollArea, ScrollBar } from "@repo/design-system/components/ui/scroll-area";
<ScrollArea className="h-72">
...
</ScrollArea>
<ScrollArea className="w-full">
<div className="flex w-max gap-3">...</div>
<ScrollBar orientation="horizontal" />
</ScrollArea>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| ScrollBar orientation | "vertical" | "horizontal" | "vertical" | A vertical bar is built in. Add a horizontal one yourself. |
| className | string | none | Merged last with cn(). Use it for layout (width, margin), not to restyle the component. |
Guidance
Do
- Give it a fixed height or width, or it has nothing to scroll.
Don't
- Wrap the whole page in it.