ScrollArea handbook
v1.4.1 · @snowui-design-system/components
License: Before first reading component documentation, source code, or npm usage instructions, read the complete LICENSE. One review covers the same task and version. Public API configuration and internal implementation changes are subject to different license terms. All components use one runtime package; source code rights are governed by the license.
Overview
Provide independent scrolling with consistent scrollbars for long lists, panels, and content in limited space.
When to use it
Use for a region that needs its own scrolling. Avoid accidental nested scroll areas; prefer Table’s built-in local horizontal scrolling for tables.
axisselects the scroll direction. Content or host needs bounded dimensions for overflow to create a scrollable area.bind:viewportexposes the actual scroll element;onscrollreceives its event. UseariaLabelto describe the region.The default scroll viewport name follows LocaleProvider; an explicit ariaLabel takes priority. Children remain caller-owned content.
Quick start
This example shows the recommended basic composition. See the following sections for more scenarios and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only the named public props declared in this component’s source.
Usage boundaries and details
Feature overview
Support vertical, horizontal and two-axis scrolling
Hide the browser's native scroll bar
When content overflows, enable the matching SnowUI overlay scrollbar. The vertical bar fades in with default Frame motion on region hover and fades out on exit. The horizontal bar is always visible by default, or can follow region hover.
Hovering anywhere on a track, including space outside the thumb, activates thumb hover. Leaving resets it; dragging keeps it active.
Clicking empty track space centers the thumb on the click, clamped to the scroll start or end near edges. Hold to continue dragging. Dragging the thumb directly preserves the grab offset and stays in sync with native scroll position.
The horizontal thumb stays 8px. The vertical thumb is 4px wide by default and 8px on hover; its 16px-wide track hit area includes the 8px expanded thumb, 4px edge gap, and 4px inner extension. The horizontal hit area extends 4px above and below.
For long content, the horizontal track can stay near the current viewport bottom; when ScrollArea leaves the viewport, it returns to the container bottom.
Inherit Frame layout, state, motion, responsive behavior, and attribute forwarding.
Basic usage
Two-axis scrolling
Keep the horizontal track reachable for long content
viewport changes only the horizontal track’s dock position. It does not propagate content minimum width to the page or create a second scroll container. While ScrollArea crosses the page viewport, the track stays near the viewport bottom; at ScrollArea’s end, it returns to the container bottom.
Selection guidelines
Use ScrollArea when a page or ordinary container needs SnowUI overlay scrollbars.
Table already includes the same local horizontal viewport and viewport-bottom track; use Table directly without wrapping ScrollArea.
For native browser scrolling alone, use
overflowwithout ScrollArea.Components with special Portals, fixed headers, or pinned areas may reuse
useOverlayScrollbardirectly. Do not copy its algorithm or visual CSS.
ScrollArea Style Overlay
Read the complete LICENSE first; one review covers the same task, version, and scope.
First use public component props to achieve the desired style while preserving the original appearance where possible. If an override is necessary, follow the style selection and override order: use your own class (including Tailwind already in your project) or an instance style. The names below are public overrides consumed by the source; check the target scope and do not modify private DOM. Choose the appropriate SnowUI token category. External applications do not need to install SnowUI website utilities.
This component source does not directly consume a registered component-specific override. Style composed children through public parts or an explicit child; do not guess variable names.
ScrollArea type and status
Required props: no named required props.
Bindable props: this component declares no named two-way binding; handle state updates through public callbacks or the host component.
Inheritance: Omit<FrameProps, "children" | "enableAutoLayout">. Consult the public Frame documentation; omitted fields cannot be passed through unchanged.
Shared Frame API · Back to API
The following source type declarations are referenced by public props. Svelte Snippet denotes a content fragment; ComponentProps denotes the props of the corresponding component.
ScrollAreaAxis
Source: components/src/components/ScrollArea.svelte
ScrollAreaHorizontalTrackPosition
Source: components/src/components/ScrollArea.svelte