edbnedbn/ui
ComponentsMapsPDF
GitHub stars
Explorer
Get Started
Components

Scroll Area

Native scroll area with custom scrollbars and edge cues.

Componentsdocsbase-ui/scroll-area

Installation

npx shadcn@latest add https://ui.edbn.me/api/analytics/registry/scroll-area.json

Manual

API Reference

ScrollArea

Composed edbn/ui wrapper around Base UI Root, Viewport, Content, Scrollbar, Thumb, and Corner.

childrenReact.ReactNode

Scrollable content rendered inside ScrollAreaContent.

orientation'vertical' | 'horizontal' | 'both'
='vertical'

Which scroll axes are wired with scrollbars and cues.

scrollFadeboolean
=true

Render non-interactive edge fades for hidden content.

chevronboolean
=true

Render the small edge chevron inside each fade cue.

cueSize'tight' | 'comfortable'
='comfortable'

Visual size of each edge fade cue.

viewportClassNamestring

Class name applied to the composed viewport part.

contentClassNamestring

Class name applied to the composed content part.

overflowEdgeThresholdnumber | Partial<{ xStart: number; xEnd: number; yStart: number; yEnd: number }>
=8

Pixels that must be passed before edge cues appear in the composed wrapper.

classNamestring | ((state) => string)

CSS class name or state-based class name callback.

styleReact.CSSProperties | ((state) => React.CSSProperties)

Inline style object or state-based style callback.

renderReactElement | ((props, state) => ReactElement)

Custom element or render function used by Base UI.

Root

Groups all parts of the scroll area. Renders a div element.

overflowEdgeThresholdnumber | Partial<{ xStart: number; xEnd: number; yStart: number; yEnd: number }>
=0

Pixels that must be passed before Base UI applies overflow edge attributes.

classNamestring | ((state) => string)

CSS class name or state-based class name callback.

styleReact.CSSProperties | ((state) => React.CSSProperties)

Inline style object or state-based style callback.

renderReactElement | ((props, state) => ReactElement)

Custom element or render function used by Base UI.

Root data attributes
AttributeDescription
data-scrollingPresent while the viewport is scrolling.
data-has-overflow-xPresent when horizontal overflow exists.
data-has-overflow-yPresent when vertical overflow exists.
data-overflow-x-startPresent when content is hidden past the horizontal start edge.
data-overflow-x-endPresent when content is hidden past the horizontal end edge.
data-overflow-y-startPresent when content is hidden above the viewport.
data-overflow-y-endPresent when content is hidden below the viewport.
Root CSS variables
VariableDescription
--scroll-area-corner-heightHeight reserved for the corner where both scrollbars meet.
--scroll-area-corner-widthWidth reserved for the corner where both scrollbars meet.

Viewport

The native scrollable viewport. Renders a div element.

classNamestring | ((state) => string)

CSS class name or state-based class name callback.

styleReact.CSSProperties | ((state) => React.CSSProperties)

Inline style object or state-based style callback.

renderReactElement | ((props, state) => ReactElement)

Custom element or render function used by Base UI.

Viewport data attributes
AttributeDescription
data-scrollingPresent while the viewport is scrolling.
data-has-overflow-xPresent when horizontal overflow exists.
data-has-overflow-yPresent when vertical overflow exists.
data-overflow-x-startPresent when content is hidden past the horizontal start edge.
data-overflow-x-endPresent when content is hidden past the horizontal end edge.
data-overflow-y-startPresent when content is hidden above the viewport.
data-overflow-y-endPresent when content is hidden below the viewport.
Viewport CSS variables
VariableDescription
--scroll-area-overflow-x-startHorizontal start overflow amount in pixels.
--scroll-area-overflow-x-endHorizontal end overflow amount in pixels.
--scroll-area-overflow-y-startVertical start overflow amount in pixels.
--scroll-area-overflow-y-endVertical end overflow amount in pixels.

Content

Container measured by Base UI for overflow and scrollbar thumb sizing.

classNamestring | ((state) => string)

CSS class name or state-based class name callback.

styleReact.CSSProperties | ((state) => React.CSSProperties)

Inline style object or state-based style callback.

renderReactElement | ((props, state) => ReactElement)

Custom element or render function used by Base UI.

Content data attributes
AttributeDescription
data-scrollingPresent while the viewport is scrolling.
data-has-overflow-xPresent when horizontal overflow exists.
data-has-overflow-yPresent when vertical overflow exists.
data-overflow-x-startPresent when content is hidden past the horizontal start edge.
data-overflow-x-endPresent when content is hidden past the horizontal end edge.
data-overflow-y-startPresent when content is hidden above the viewport.
data-overflow-y-endPresent when content is hidden below the viewport.
Content CSS variables
VariableDescription
--scroll-area-overflow-x-startHorizontal start overflow amount in pixels.
--scroll-area-overflow-x-endHorizontal end overflow amount in pixels.
--scroll-area-overflow-y-startVertical start overflow amount in pixels.
--scroll-area-overflow-y-endVertical end overflow amount in pixels.

Scrollbar

A vertical or horizontal custom scrollbar. Renders a div element.

orientation'vertical' | 'horizontal'
='vertical'

Scrollbar axis controlled by this part.

keepMountedboolean
=false

Keep the scrollbar element mounted when its viewport is not scrollable.

classNamestring | ((state) => string)

CSS class name or state-based class name callback.

styleReact.CSSProperties | ((state) => React.CSSProperties)

Inline style object or state-based style callback.

renderReactElement | ((props, state) => ReactElement)

Custom element or render function used by Base UI.

Scrollbar data attributes
AttributeDescription
data-scrollingPresent while the viewport is scrolling.
data-has-overflow-xPresent when horizontal overflow exists.
data-has-overflow-yPresent when vertical overflow exists.
data-overflow-x-startPresent when content is hidden past the horizontal start edge.
data-overflow-x-endPresent when content is hidden past the horizontal end edge.
data-overflow-y-startPresent when content is hidden above the viewport.
data-overflow-y-endPresent when content is hidden below the viewport.
data-hoveringPresent while the scroll area is hovered.
data-orientationScrollbar orientation: vertical or horizontal.
Scrollbar CSS variables
VariableDescription
--scroll-area-thumb-heightCalculated thumb height for vertical scrolling.
--scroll-area-thumb-widthCalculated thumb width for horizontal scrolling.

Thumb

The draggable part of a scrollbar that indicates scroll position.

classNamestring | ((state) => string)

CSS class name or state-based class name callback.

styleReact.CSSProperties | ((state) => React.CSSProperties)

Inline style object or state-based style callback.

renderReactElement | ((props, state) => ReactElement)

Custom element or render function used by Base UI.

Thumb data attributes
AttributeDescription
data-orientationThumb orientation: vertical or horizontal.

Corner

The small rectangle at the intersection of horizontal and vertical scrollbars.

classNamestring | ((state) => string)

CSS class name or state-based class name callback.

styleReact.CSSProperties | ((state) => React.CSSProperties)

Inline style object or state-based style callback.

renderReactElement | ((props, state) => ReactElement)

Custom element or render function used by Base UI.

EdgeCue

Optional edbn/ui fade utility used by the composed ScrollArea wrapper.

edge'top' | 'bottom' | 'left' | 'right'Required

Viewport edge where the cue is positioned.

cueSize'tight' | 'comfortable'
='comfortable'

Visual size of the fade cue.

chevronboolean
=true

Render the small chevron inside the fade cue.

visibleboolean

Force cue visibility. When omitted, Base UI overflow data attributes drive visibility.

classNamestring

CSS class name.

styleReact.CSSProperties

Inline style object.

EdgeCue data attributes
AttributeDescription
data-edgeThe edge where the cue is rendered.
data-visibleSet to true when visibility is forced with the prop.