Scroll Area
Constrain overflowing content with styled scrollbars.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/scroll-areaComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/badgeUsage
import { ScrollArea } from "@/siteplane/components/scroll-area";
<div className="h-40">
<ScrollArea>Content</ScrollArea>
</div>;Fade the edges
Set scrollFade to fade the edges of the viewport where more content waits. The top fades once the content is scrolled down, the bottom while more follows, and the left and right edges do the same. An edge with nothing beyond it stays sharp, and the fade grows with the distance left to scroll, up to 1.5rem. It is off by default on ScrollArea itself. SidebarContent and the lists of Combobox and Autocomplete always fade, and the panels of Dialog, Sheet and Drawer fade unless you pass scrollFade={false}.
Horizontal scrolling
Give the content an intrinsic width, such as w-max, so it scrolls horizontally. scrollbarGutter reserves space so the scrollbar doesn't cover the content, and scrollFade fades the edge that still has content beyond it.
Both axes
Content that is wider and taller than the viewport scrolls in both directions. With scrollFade, each edge fades on its own.
Fill the viewport
Set fill when the content is a flex column that should stretch to the viewport height, for example to pin a footer with mt-auto.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
scroll | boolean | false | Fades each edge that has more content beyond it (top, bottom, left, right) by up to 1.5rem, growing with the distance left to scroll. An edge with nothing beyond it stays sharp. |
scrollbar | auto | hidden | auto | Render both automatic scrollbars or neither. |
scrollbar | boolean | false | Add viewport padding when overflow exists. |
fill | boolean | false | Content gets full viewport size. |
clamp | boolean | true | Content min-width is set to zero; false preserves intrinsic sizing. |
aria-label / aria-labelledby | string | unset | Names the scrollable viewport, which then becomes a labeled region. |
Scroll | horizontal | vertical | vertical | Low-level scrollbar direction. |
ScrollArea wraps Base UI Root and automatically includes Viewport, Content,
vertical/horizontal ScrollBar and Corner. ScrollBar automatically includes
Thumb. ScrollAreaPrimitive exposes Base UI Scroll
Area. Other root props and
refs are inherited; className is a string. There is no separate viewportProps or
contentProps bag. aria-label and aria-labelledby go to the scrollable
viewport; other root props, including other ARIA attributes, apply to the root
element, which Base UI renders with role="presentation". Use the lower-level
Base UI parts only if this wrapper cannot represent your use case.
Usage notes
The viewport joins the tab order while its content overflows, so keyboard users can focus it and scroll with the arrow keys. Name it with aria-label or aria-labelledby so screen readers announce what it contains. scrollbar="hidden" hides the scrollbars but not the scrolling; keep overflow discoverable. Root scroll handlers are not a dedicated viewport callback API. Constrain the parent size; setting height only on oversized child content does not create a usable viewport.