Scroll Area
OverlayA scroll container with a styled, theme-aware scrollbar.
Scroll areas render a native scroll viewport with a custom scrollbar. The thumb inherits the muted theme color and stays subtle until you scroll or hover.
npx shadcn@latest add scroll-areaVertical scroll
A fixed-height container that scrolls through long content.
Preview
Livetsx
1<ScrollArea className="h-40 w-72 rounded-lg border">2 <div className="flex flex-col gap-3 p-4 text-sm">3 <p>Paragraph one</p>4 <p>Paragraph two</p>5 </div>6</ScrollArea>
Composition
The scrollbar and thumb can be assembled independently.
Preview
Livetsx
1<ScrollArea className="h-40 w-72 rounded-lg border">2 <ScrollAreaViewport>...</ScrollAreaViewport>3 <ScrollAreaScrollbar orientation="vertical">4 <ScrollAreaThumb />5 </ScrollAreaScrollbar>6 <ScrollAreaCorner />7</ScrollArea>
API reference
All props of the underlying Base UI primitive are forwarded. The table below documents the Shelf-specific props.
| Prop | Type | Description |
|---|---|---|
| className | string | Sets the fixed dimensions and frame styling of the root. |
| orientation | "vertical" | "horizontal"= "vertical" | Scrollbar orientation. |
| overflowEdgeThreshold | number | Threshold in px before edge overflow is reported. |
| keepMounted | boolean= false | Keep the scrollbar in the DOM when not scrollable. |