Scroll Area
Bounded overflow regions with keyboard scrolling, overlay scrollbars and optional edge fades.
Purpose
Use Scroll Area when content must overflow a deliberately bounded region while retaining Siteplane overlay scrollbars and keyboard scrolling.
Basic usage
Installation
With the Siteplane registry alias configured, add the component and import the installed source from your app.
CLI
pnpm dlx shadcn@4.16.1 add @siteplane/scroll-areaImport
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Separator } from "@/components/ui/separator";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";Need the machine-readable source metadata? View registry JSON.
Usage
Scroll Area gives constrained content a styled scrollbar and optional scroll fade. The root needs a height or width constraint from its parent, and it mounts both scrollbars and the corner internally.
import { ScrollArea } from "@/components/ui/scroll-area";
export function Example() {
return (
<ScrollArea className="h-40">
<div>Scrollable content</div>
</ScrollArea>
);
}Examples
Horizontal rows, both axes, the scrollbar gutter and fixed-chrome bodies are props and compositions of the same primitive.
Horizontal
A w-max row forces overflow; the horizontal scrollbar comes from the primitive.
Both axes
Content wider and taller than the box scrolls on both axes; the corner is handled internally.
Scrollbar gutter
scrollbarGutter reserves edge padding only while the axis overflows, so rows never sit under the scrollbar.
Card scroll body
Header and footer stay fixed; only the body scrolls inside its height constraint.
API Reference
The reference lists the source-owned exports and props that are easy to miss in visual examples. Inherited Base UI props remain available unless the wrapper narrows them.
ScrollAreaacceptsscrollFade,scrollbarGutter,fillandclampContentMinWidthin addition to the Base UI root props.fillmakes the content fill the viewport, which is useful for full-height children and centered empty states.clampContentMinWidthdefaults totrue; set it tofalsewhen intrinsic-width content should create horizontal scrolling instead of shrinking.ScrollBaris exported for custom composition and acceptsorientation="vertical" | "horizontal".
Motion
Component motion uses the shared Siteplane motion contract. See the global motion guide for provider setup, tokens and reduced-motion behavior.
- Scrollbars fade through the native Siteplane Scroll Area transition. Content itself does not animate as it scrolls.
- The operating-system reduced-motion preference removes the scrollbar fade and its delay. The forced
reducedMotionPresetsets the active fade duration to 0ms while keeping scrolling and the scrollbar usable.
Accessibility
- Give the region an accessible name and a real bounded height or width.
- Preserve the focusable viewport and visible focus ring for keyboard scrolling.
- Do not hide required actions beyond an undiscoverable scroll boundary, and use pagination for very large datasets.
Implementation Guidance
- Avoid nested scroll areas on the same axis.
- Choose
clampContentMinWidth={false}for wide tables or rows that must retain intrinsic width. - Do not replace large-data pagination with one indefinitely growing Scroll Area.