Scroll Area API
View componentThe full prop reference for the Scroll Area component. A container with custom, themeable scrollbars.
Import
import { ScrollArea } from '@structyl/styled';Props
Root
The root container for the scroll area. Wraps the viewport and scrollbars. Supports all standard div props.
| Prop | Type | Default |
|---|---|---|
| asChild# | booleanRender as a child element instead of a div | — |
| type# | 'auto' | 'always' | 'scroll' | 'hover'Scrollbar visibility behavior: auto (visible on hover), always (always visible), scroll (visible during scroll), or hover (visible on pointer enter) | 'hover' |
| scrollHideDelay# | numberDelay in milliseconds before hiding the scrollbar when using type='scroll' or type='hover' | 600 |
| className# | stringCSS class name for styling (styled version adds 'relative overflow-hidden') | — |
| children# | React.ReactNodeContent to scroll (primitives use as Viewport children; styled version accepts content directly) | — |
| style# | React.CSSPropertiesInline styles (merged with position: 'relative') | — |
| ref# | React.Ref<HTMLDivElement>Forwarded ref to the root div element | — |
Viewport
The scrollable container (primitives only). In styled version, this is pre-configured inside Root.
| Prop | Type | Default |
|---|---|---|
| tabIndex# | numberTab index for keyboard navigation (defaults to 0) | 0 |
| className# | stringCSS class name for styling (styled version pre-applies 'h-full w-full rounded-[inherit]') | — |
| style# | React.CSSPropertiesInline styles (merged with overflow: 'auto' and WebkitOverflowScrolling: 'touch') | — |
| children# | React.ReactNodeContent to be scrolled | — |
| ref# | React.Ref<HTMLDivElement>Forwarded ref to the viewport div element | — |
Scrollbar
The scrollbar track container. Manages visibility and orientation.
| Prop | Type | Default |
|---|---|---|
| orientation# | 'horizontal' | 'vertical'Scrollbar orientation (vertical for up-down scrolling, horizontal for left-right scrolling) | 'vertical' |
| forceMount# | booleanForce the scrollbar to mount and be visible regardless of type or scroll state | — |
| className# | stringCSS class name for styling (styled version pre-applies flex, touch-none, select-none, transition-colors, and orientation-specific classes) | — |
| style# | React.CSSPropertiesInline styles (merged with position: 'absolute' and orientation-specific positioning) | — |
| ref# | React.Ref<HTMLDivElement>Forwarded ref to the scrollbar div element | — |
Thumb
The draggable thumb element (handle) on the scrollbar. Automatically sizes and positions based on scroll ratio.
| Prop | Type | Default |
|---|---|---|
| className# | stringCSS class name for styling (styled version pre-applies 'relative flex-1 rounded-full bg-border') | — |
| style# | React.CSSPropertiesInline styles (merged with computed width, height, and translate transform) | — |
| ref# | React.Ref<HTMLDivElement>Forwarded ref to the thumb div element | — |
Corner
The corner element displayed where horizontal and vertical scrollbars meet (primitives only, not exposed in styled).
| Prop | Type | Default |
|---|---|---|
| className# | stringCSS class name for styling | — |
| style# | React.CSSPropertiesInline styles | — |
| ref# | React.Ref<HTMLDivElement>Forwarded ref to the corner div element | — |
Source code
If you didn't find what you need here, read the component implementation .