Components
Scroll Area
A high-quality, styled React scroll area component built with @base-ui/react for smooth custom scrollbar rendering.
The ScrollArea component wraps scrollable content to provide custom, cross-browser styled scrollbars with smooth hover and interaction states.
Usage
import { ScrollArea } from "@/components/ui/scroll-area";
export function ExampleScrollArea() {
return (
<ScrollArea.Root className="h-44 w-80">
<ScrollArea.Viewport>
<ScrollArea.Content>
<p>Long scrollable content goes here...</p>
</ScrollArea.Content>
</ScrollArea.Viewport>
<ScrollArea.Scrollbar>
<ScrollArea.Thumb />
</ScrollArea.Scrollbar>
<ScrollArea.Corner />
</ScrollArea.Root>
);
}Preview
Anatomy
import { ScrollArea } from "@base-ui/react/scroll-area";
<ScrollArea.Root>
<ScrollArea.Viewport>
<ScrollArea.Content />
</ScrollArea.Viewport>
<ScrollArea.Scrollbar>
<ScrollArea.Thumb />
</ScrollArea.Scrollbar>
<ScrollArea.Corner />
</ScrollArea.Root>;API Reference
ScrollArea.Root Props
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'sm' | 'md' | 'lg' | 'md' | Width/height size of custom scrollbars. |
ScrollArea.Scrollbar Props
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | 'vertical' | 'horizontal' | 'vertical' | Orientation axis of the scrollbar. |