Scroll Area
A scroll container with a thin custom scrollbar that matches the product surface.
Vertical
Give the area a fixed height; content past it scrolls. When the content has no focusable children, set viewportLabel so keyboard users can focus the area and scroll it with the arrow keys.
Horizontal
Set orientation="horizontal" to render a horizontal scrollbar. A direction without a scrollbar does not scroll. Use "both" for content that scrolls both ways.
Installation
pnpm dlx shadcn@latest add @narakui/scroll-areaAdd "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/scroll-area.json.
Properties
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Scrollable content. |
orientation | 'vertical' | 'horizontal' | 'both' | 'vertical' | Scrollbars to render. A direction without a scrollbar does not scroll. |
type | 'auto' | 'always' | 'scroll' | 'hover' | 'hover' | When the scrollbars are visible. With hover, they show while the pointer is over the area or it is scrolling. |
viewportLabel | string | — | Accessible name for the viewport. Also makes it a focusable region, so keyboard users can scroll it. |
viewportRef | Ref<HTMLDivElement> | — | Ref to the scrolling viewport, for reading or setting the scroll position. |
viewportClassName | string | — | Additional classes for the viewport. |
scrollbarClassName | string | — | Additional classes for the scrollbars. |
className | string | — | Additional classes for the root. |