Usage
Simply wrap elements in <ScrollArea>
. You must define a height
or a max-height
.
Horizontal scroll
A horizontal scrollbar will appear when setting a width
or max-width
.
Dark mode
You can change the theme
between "light"
(default) and "dark"
.
Scrollbar visibility
The type
prop for <ScrollArea>
describes the nature of scrollbar visibility, similar to how the scrollbar preferences in MacOS control visibility of native scrollbars.
type
can be set to "auto"
, "always"
, "scroll"
, or "hover"
(default).
"auto"
means that scrollbars are visible when content is overflowing on the corresponding orientation."always"
means that scrollbars are always visible regardless of whether the content is overflowing."scroll"
means that scrollbars are visible when the user is scrolling along its corresponding orientation."hover"
means that scrollbars are visible when the user is scrolling along its corresponding orientation and when the user is hovering over the scroll area.
API Reference
ScrollArea
Inherits properties from HTMLElement
.
Prop | Type | Default |
---|---|---|
asChild | boolean | false |
children | ReactNode | |
className | string | |
forceMount | true undefined | |
scrollHideDelay | number | 600 |
theme | "dark" "light" | "light" |
type | "auto" "always" "scroll" "hover" | "hover" |