Scroll Area
A native scroll container with custom scrollbars.
Anatomy
Import the component and assemble its parts:
import { ScrollArea } from '@base-ui-components/react/scroll-area';
<ScrollArea.Root>
<ScrollArea.Viewport />
<ScrollArea.Scrollbar>
<ScrollArea.Thumb />
</ScrollArea.Scrollbar>
<ScrollArea.Corner />
</ScrollArea.Root>
API reference
Root
Groups all parts of the scroll area.
Renders a <div>
element.
Prop | Type | Default | |
---|---|---|---|
className |
|
| |
render |
|
|
CSS Variable | Description | |
---|---|---|
--scroll-area-corner-height | The scroll area's corner height. | |
--scroll-area-corner-width | The scroll area's corner width. |
Viewport
The actual scrollable container of the scroll area.
Renders a <div>
element.
Prop | Type | Default | |
---|---|---|---|
className |
|
| |
render |
|
|
Content
A container for the content of the scroll area.
Renders a <div>
element.
Prop | Type | Default | |
---|---|---|---|
className |
|
| |
render |
|
|
Scrollbar
A vertical or horizontal scrollbar for the scroll area.
Renders a <div>
element.
Prop | Type | Default | |
---|---|---|---|
orientation |
|
| |
className |
|
| |
keepMounted |
|
| |
render |
|
|
Attribute | Description | |
---|---|---|
data-orientation | Indicates the orientation of the scrollbar. | |
data-hovering | Present when the pointer is over the scroll area. | |
data-scrolling | Present when the users scrolls inside the scroll area. |
CSS Variable | Description | |
---|---|---|
--scroll-area-thumb-height | The scroll area thumb's height. | |
--scroll-area-thumb-width | The scroll area thumb's width. |
Thumb
The draggable part of the the scrollbar that indicates the current scroll position.
Renders a <div>
element.
Prop | Type | Default | |
---|---|---|---|
className |
|
| |
render |
|
|
Attribute | Description | |
---|---|---|
data-orientation | Indicates the orientation of the scrollbar. |
Corner
A small rectangular area that appears at the intersection of horizontal and vertical scrollbars.
Renders a <div>
element.
Prop | Type | Default | |
---|---|---|---|
className |
|
| |
render |
|
|