Scroll Area
ScrollArea replaces the browser's default scrollbar with a thin Fluent-style one that appears on hover.
Built on Radix Scroll Area, so native scrolling (wheel, touch, keyboard) still works. orientation picks a vertical scrollbar, a horizontal one or both.
Import
Install from npm, copy the source into your project with @yugen-ui/cli or the shadcn CLI, or import directly when working in this repo.
TSX
// npm install yugen-uiimport { ScrollArea, ScrollBar } from "yugen-ui";Variants
Each tile is a standalone example: hover to copy, or press Code to see the source.
Horizontal
orientation="horizontal" for strips of cards or images.
Both directions
orientation="both" for a grid larger than its frame.
Usage
Do
- Give the ScrollArea a fixed height or width so the scroll region is clear.
- Use it for panels and long lists inside small surfaces (Popover, Card, Drawer).
Don't
- Don't wrap the whole page in a ScrollArea. Let the browser scroll the page.
- Don't nest scroll areas that scroll in the same direction.
Props
| Prop · Type | Default | Description |
|---|---|---|
| orientation"vertical" | "horizontal" | "both" | Default: "vertical" | Scrollbars shown. |
| type"hover" | "scroll" | "auto" | "always" | Default: "hover" | When the scrollbars appear (Radix). |
| viewportClassNamestring | Default: — | Class for the inner viewport. |
| ScrollBar | Default: "vertical" | For composing the Radix primitives yourself. |