ScrollArea
Area with custom scrollbars
Import
Source
Docs
Package
Usage
ScrollArea component is based on Radix UI scroll area component. It is adapted to work well with light and dark color schemes and supports the following props:
typedefines scrollbars behavior:hover– scrollbars are visible on hoverscroll– scrollbars are visible on scrollauto– similar tooverflow: auto– scrollbars are always visible whether the content is overflowingalways– same asautobut scrollbars are always visible regardless of whether the content is overflowing
offsetScrollbars– offset scrollbars with paddingscrollbarSize– scrollbar size in px, controls scrollbar and thumb width/heightscrollHideDelay– delay in ms to hide scrollbars, applicable only when type ishoverorscroll
Horizontal scrollbars
Subscribe to scroll position changes
Provider onScrollPositionChange function to subscribe to scroll position changes,
it will be called each time user scrolls with x and y coordinates:
Scroll position:
{ x: 0, y: 0 }Scroll to position
To programmatically scroll to any position,
get viewport element ref with viewportRef prop and call scrollTo method:
Usage with other components
ScrollArea integrates seamlessly with all Mantine components that can require scrollbars. For example, it can be used with Navbar.Section component: