structyl

Scroll Area API

View component

The full prop reference for the Scroll Area component. A container with custom, themeable scrollbars.

Import

tsx
import { ScrollArea } from '@structyl/styled';

Props

Root

The root container for the scroll area. Wraps the viewport and scrollbars. Supports all standard div props.

PropTypeDefault
asChild#boolean

Render 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#number

Delay in milliseconds before hiding the scrollbar when using type='scroll' or type='hover'

600
className#string

CSS class name for styling (styled version adds 'relative overflow-hidden')

children#React.ReactNode

Content to scroll (primitives use as Viewport children; styled version accepts content directly)

style#React.CSSProperties

Inline 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.

PropTypeDefault
tabIndex#number

Tab index for keyboard navigation (defaults to 0)

0
className#string

CSS class name for styling (styled version pre-applies 'h-full w-full rounded-[inherit]')

style#React.CSSProperties

Inline styles (merged with overflow: 'auto' and WebkitOverflowScrolling: 'touch')

children#React.ReactNode

Content to be scrolled

ref#React.Ref<HTMLDivElement>

Forwarded ref to the viewport div element

Scrollbar

The scrollbar track container. Manages visibility and orientation.

PropTypeDefault
orientation#'horizontal' | 'vertical'

Scrollbar orientation (vertical for up-down scrolling, horizontal for left-right scrolling)

'vertical'
forceMount#boolean

Force the scrollbar to mount and be visible regardless of type or scroll state

className#string

CSS class name for styling (styled version pre-applies flex, touch-none, select-none, transition-colors, and orientation-specific classes)

style#React.CSSProperties

Inline 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.

PropTypeDefault
className#string

CSS class name for styling (styled version pre-applies 'relative flex-1 rounded-full bg-border')

style#React.CSSProperties

Inline 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).

PropTypeDefault
className#string

CSS class name for styling

style#React.CSSProperties

Inline 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 .

structyl — Accessible React Component Library