Display
Scroll area
Thin overlay scrollbars and edge fades.
Changelog
The browser still does the scrolling, so wheel, touch, trackpad, find-in-page and keyboard behave natively. The slim thumb is an overlay on top of it, and the edges fade only where there is more to read. Scroll the list and watch the top fade appear.
When to use
- A panel with a fixed height whose content can grow: changelogs, logs, side lists, chat history.
- A row of cards or chips that may overflow sideways.
Not for the page itself (let the page scroll) or for short content that always fits.
Horizontal
Use orientation="horizontal" (or both). The content wrapper sizes to its content, so a flex row with shrink-0 items overflows instead of squashing.
API
ScrollArea
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | 'vertical' | 'horizontal' | 'both' | 'vertical' | Which axes scroll. |
| label | string | 'Scrollable content' | Accessible name of the scrollable region. |
| fade | boolean | true | Fade edges that have more content beyond them. |
| scrollbar | 'hover' | 'always' | 'hover' | Thumbs show on hover, focus and while scrolling, or always. |
| viewportClassName | string | — | Class for the scrolling element (className styles the root, e.g. its height). |
| viewportRef | Ref<HTMLDivElement> | — | The scrolling element, for scrollTo and friends. |
Size it from outside: h-80 or max-h-80 on the root. CSS knobs: --ui-scroll-fade-size (default 1.5rem).
Keyboard
| Key | Action |
|---|---|
| Tab | Focuses the scroll region (it has a visible focus ring). |
| ↑ ↓ ← → | Scroll by a line. |
| Page Up / Page Down / Space | Scroll by a page. |
| Home / End | Jump to the start / end. |
Accessibility
- The viewport is role="region" with tabindex="0" and an aria-label, so keyboard users can reach and scroll it (axe: scrollable-region-focusable).
- The custom thumbs are aria-hidden; the native scroll position is what assistive tech reads.
- Dragging the thumb or pressing the track is an extra for pointers, never the only way to scroll.
Motion
- Thumbs fade in on hover and while scrolling; edge fades animate in over 220ms.
- Reduced motion: both appear without animation.