Scrollable is a utility component that provides a scrollable container with configurable overflow behavior and edge detection capabilities.
The component can be imported via:
The Scrollable component provides a scrollable container with configurable overflow behavior and edge detection capabilities. It's useful for creating scrollable areas that need to respond when content reaches the edges.
The overflow prop controls which direction the content can scroll:
'x': Horizontal scrolling only'y': Vertical scrolling only'both': Both horizontal and vertical scrolling'hidden': No scrolling, content is clippedThe Scrollable component provides callbacks that fire when content touches or leaves any edge (top, right, bottom, left):
onTouchEdge: Called when content touches an edgeonLeaveEdge: Called when content leaves an edgeThese callbacks are useful for implementing custom scroll behaviors, UI indicators, and infinite scrolling.
You can configure how close to an edge the content needs to be to trigger the callbacks using the edgeThreshold prop. This value represents the distance in pixels from the edge:
The withEdgeIndicators prop enables visual fade effects at the edges to indicate when more content is available for scrolling. It uses CSS mask-image to fade the actual content pixels at scroll edges, creating a clean visual cue without z-index issues or overlaying gradients.
Edge indicators are shown when:
withEdgeIndicators is trueedgeThreshold)'x' or 'y', not 'both')This content is taller than the container.
Scroll to see fade indicators at top/bottom when not at the edges.
PlumaScrollable extends BoxDistance threshold in pixels from edge to trigger onTouchEdge/onLeaveEdge callbacks
Callback fired when the scrollable content leaves an edge
Callback fired when the scrollable content touches an edge
Controls the overflow behavior of the component
Whether to show edge fade indicators at the edges when content is scrollable but not currently at that edge. Uses CSS mask-image to fade the actual content pixels at scroll edges.
The fade size defaults to 48px and can be overridden via the CSS variable
exposed in scrollable.vars.fadeSize.