Components

Scroll Area

A React scroll area with native scrolling, Liquid Glass scrollbars, and a glass panel.

ScrollArea renders the glass panel, native scroll viewport, content container, and custom scrollbars internally.

Native scrollbars are hidden. The themed scrollbars stay subtle at rest and brighten while the pointer is over the area or the viewport is scrolling. They only render when the content actually overflows.

Basic example

ScrollArea has no intrinsic height. Give the root a height with className to create a scrollable viewport. The example below also passes aria-label, which is forwarded to the scrollable viewport instead of the presentation root.

Horizontal scrolling

Set orientation="horizontal" to render only the horizontal scrollbar. Content wider than the viewport can still be scrolled with a trackpad, wheel, or keyboard.

Both axes

Use orientation="both" for two-dimensional content. The corner is rendered so the two scrollbars never overlap.

Sizing and content

The root owns the glass surface. Use className for its width, height, radius, and outer layout. Padding belongs inside the content, as the examples do, so list rows can also run edge to edge when needed.

Edge threshold

overflowEdgeThreshold controls how close the viewport must be to an edge before the data-overflow-* attributes change. The example reacts after 16px of scrolling.

The ring appears once the viewport scrolls 16px past the top edge.

Accessibility

The viewport is focusable only while it can scroll, matching native scroll-container behavior. Pass aria-label or aria-labelledby to name the region, and aria-describedby for extra instructions.

Pointer and keyboard scrolling stay native, while the custom scrollbars remain decorative and hidden from assistive technology. See the accessibility guide for region naming.

API reference

PropTypeDefaultDescription
childrenReactNode—Scrollable content rendered inside the viewport.
orientation"vertical" | "horizontal" | "both""vertical"Scrollbar axes to render.
overflowEdgeThresholdnumber | Partial<{ xStart: number; xEnd: number; yStart: number; yEnd: number }>0Distance in pixels before an edge is marked as overflowing.
aria-labelstring—Accessible name forwarded to the scrollable viewport.
aria-labelledbystring—ID of an element that labels the viewport.
aria-describedbystring—ID of an element that describes the viewport.
renderReactElement | ((props, state) => ReactElement)—Replaces the root element.
refRef<HTMLDivElement>—Ref forwarded to the root element.
classNamestring—Tailwind classes merged into the root. Set the height here.
styleCSSProperties—Inline styles merged into the same element as className.
ui{ root?: ClassValue; glass?: ClassValue; overlay?: ClassValue; viewport?: ClassValue; content?: ClassValue; scrollbar?: ClassValue; thumb?: ClassValue; corner?: ClassValue }—Tailwind classes for internal slots, keyed by data-slot.
AttributeDescription
data-orientationIndicates the enabled scrollbar axes (horizontal, vertical, or both).
data-scrollingPresent while the user scrolls inside the area.
data-has-overflow-xPresent when content is wider than the viewport.
data-has-overflow-yPresent when content is taller than the viewport.
data-overflow-x-startPresent when there is horizontal overflow on the start side.
data-overflow-x-endPresent when there is horizontal overflow on the end side.
data-overflow-y-startPresent when there is vertical overflow on the start side.
data-overflow-y-endPresent when there is vertical overflow on the end side.
data-hoveringPresent on a scrollbar while the pointer is over the area.
data-slotMarks internal parts (root, glass, overlay, viewport, content, scrollbar, thumb, corner) for styling.

Theming

The component uses the shared glass material. Tune shared --ui-glass-* tokens on a parent, use className for layout, and use ui for internal slots keyed by data-slot. Component-specific values live in src/theme/scroll-area.ts. See the theming guide for token layers and presets.

  • Card — A static panel for content that fits.
  • Tabs — For switching between views.
  • Drawer — For an edge panel with its own scrolling.