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.

PropTypeDefaultRequired
asenumdiv
overflowXenum"auto"
overflowYenum"auto"
scrollbarVisibilityenum"hover"
scrollbarVisibilityRestTimeoutnumber600
trackClickBehavioremum"relative"

The viewport area of the scroll area.

PropTypeDefaultRequired
asenumdiv

The horizontal scrollbar.

PropTypeDefaultRequired
asenumdiv

The vertical scrollbar.

PropTypeDefaultRequired
asenumdiv

The start button to be used in ScrollArea.ScrollbarX and ScrollArea.ScrollbarY.

PropTypeDefaultRequired
asenumdiv

The end button to be used in ScrollArea.ScrollbarX and ScrollArea.ScrollbarY.

PropTypeDefaultRequired
asenumdiv

The track to be used in ScrollArea.ScrollbarX and ScrollArea.ScrollbarY.

PropTypeDefaultRequired
asenumdiv

The thumb to be used in ScrollArea.ScrollbarX and ScrollArea.ScrollbarY.

PropTypeDefaultRequired
asenumdiv

The corner where both vertical and horizontal scrollbars meet.

PropTypeDefaultRequired
asenumdiv

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.