Scroll Area
Augments native scroll functionality for custom, cross-browser styling.
Features
- Track sits on top of the scrollable content, taking up no space.
- Scrolling is native; no underlying position movements via CSS transformations.
- Shims pointer behaviors only when interacting with the controls, so keyboard controls are unaffected.
- Progressively enhanced so that content is avalaible on devices where custom controls aren't supported.
Install the component from your command line.
Import the components and piece the parts together.
Create your styled scroll area component from the primitive parts.
Contains all the parts of a scroll area.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div | |
overflowX | enum | "auto" | |
overflowY | enum | "auto" | |
scrollbarVisibility | enum | "hover" | |
scrollbarVisibilityRestTimeout | number | 600 | |
trackClickBehavior | emum | "relative" |
The viewport area of the scroll area.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div |
The horizontal scrollbar.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div |
The vertical scrollbar.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div |
The start button to be used in ScrollArea.ScrollbarX
and ScrollArea.ScrollbarY
.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div |
The end button to be used in ScrollArea.ScrollbarX
and ScrollArea.ScrollbarY
.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div |
The track to be used in ScrollArea.ScrollbarX
and ScrollArea.ScrollbarY
.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div |
The thumb to be used in ScrollArea.ScrollbarX
and ScrollArea.ScrollbarY
.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div |
The corner where both vertical and horizontal scrollbars meet.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div |
In most cases, it's best to rely on native scrolling and work with the customization options available in CSS. When that isn't enough, ScrollArea
provides additional customizability while maintaining the browser's native scroll behavior (as well as accessibiliy features, like keyboard scrolling).
Scrolling via keyboard is supported by default because the component relies on native scrolling. Specific keyboard interactions may differ between platforms, so we do not specify them here or add specific event listeners to handle scrolling via key events.