Scroll Area
A scrollable region with token-styled scrollbars. Built on the Radix UI Scroll Area primitive.
Usage
import { ScrollArea, ScrollBar } from "@reva/ui";ScrollArea automatically renders a vertical ScrollBar. To enable horizontal scrolling, render <ScrollBar orientation="horizontal" /> as a sibling inside ScrollArea. Use ScrollArea for bounded scrollable surfaces — its strongest case is horizontal scroll, where native scrollbars are inconsistent and undiscoverable. Don't wrap the document body or virtualised lists.
Composition
Use the following composition to build a ScrollArea:
ScrollArea
├── (scrollable content)
└── ScrollBarScrollBar is rendered automatically for the vertical axis. Add <ScrollBar orientation="horizontal" /> as a sibling when content overflows horizontally.
Examples
Horizontal
A row of asset-class cards inside a fixed-width ScrollArea with <ScrollBar orientation="horizontal" />. This is the strongest case for ScrollArea — native horizontal scrollbars are platform-inconsistent and undiscoverable on mobile.
Both axes
Render a ScrollArea with both a vertical and a horizontal ScrollBar for content that overflows on both axes (e.g. wide tables, long activity feeds).
Type
Use the type prop to control when the scrollbar is visible.
- hover — default. Bar appears on hover or scroll. Best for desktop, low-discoverability content.
- always — bar is always visible. Use when the affordance must be discoverable (command palettes, mobile horizontal rows).
- scroll — bar fades in while scrolling, fades out when idle. Bridges hover and always.
hover
Default. Bar appears on hover or scroll.
always
Bar is always visible — use when discoverability matters.
scroll
Bar fades in while scrolling, fades out when idle.
Props
ScrollArea and ScrollBar forward props to the Radix primitives. See the Radix UI Scroll Area documentation for the full API.
ScrollArea
| Prop | Type | Default | Description |
|---|---|---|---|
type | "auto" | "always" | "scroll" | "hover" | "hover" | When the scrollbar is visible. |
scrollHideDelay | number | 600 | Delay in ms before the scrollbar hides when type="scroll" or "hover". |
dir | "ltr" | "rtl" | inherited | Reading direction. |
asChild | boolean | false | Render the root via the child element. |
ScrollBar
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | "horizontal" | "vertical" | "vertical" | Axis the scrollbar controls. Add a horizontal ScrollBar as a sibling for horizontal scroll. |
forceMount | boolean | false | Force render the scrollbar (useful for animation). |