Scroll Area
A scrollable container with a custom scrollbar that is consistent across browsers.
When To Use
Use the Scroll Area component when you need to:
- Create a scrollable container with a custom scrollbar
- Ensure consistent scrollbar styling across different browsers
- Control the appearance and behavior of scrollbars
- Maintain a uniform UI design regardless of the user's operating system
- Create scrollable areas with limited height or width
Scroll Areas are especially useful for creating contained scrollable sections within a page, such as side panels, code blocks, long lists, and modal content.
Examples
Scroll horizontally to view all images
This ScrollArea has a max-height of 200px and will only show a scrollbar when the content exceeds this height.
Code Block Style
Colorful Style
Props
ScrollArea
| Prop | Type | Default |
|---|---|---|
scrollHideDelay? | number | - |
type? | "auto" | "always" | "scroll" | "hover" | - |
asChild? | boolean | - |
key? | Key | null | - |
ScrollBar
| Prop | Type | Default |
|---|---|---|
orientation? | "horizontal" | "vertical" | - |
forceMount? | true | - |
asChild? | boolean | - |
key? | Key | null | - |