Scroll Area
A scroll container with custom, themeable scrollbars.
Usage
ScrollArea wraps overflowing content in a native scroll container, then paints its own slim,
themeable scrollbar on top — so scrollbars look identical across macOS, Windows, and Linux instead of
inheriting the OS chrome. It scrolls only once it has a bounded size and content that overflows
it: give the area a height (and/or width) via className, and let the content inside determine the
overflow.
It's a folded single element — you render ScrollArea and your content, and the viewport, scrollbars,
and thumb are wired up internally. Reach the inner scroll viewport (for a ref, onScroll, or extra
classes) through the viewportProps escape hatch.
Examples
Vertical scrolling
The default orientation. The area fills its parent's width and scrolls vertically once the content
is taller than the set height.
Horizontal scrolling
Set orientation="horizontal" for a row of items wider than the container — carousels, tag rows, or
code blocks. The area sizes to its content's height and scrolls sideways.
Both axes
orientation="both" renders a scrollbar on each axis plus a corner where they meet — handy for wide
tables or grids that overflow in two directions.
Scroll shadow
Set scrollShadow to fade the content at whichever edges can still scroll, hinting that there's more
beyond the fold. It's a CSS mask on the viewport, so it tracks scrolling with no runtime cost and
clears once an edge is fully reached.
Scrollbar visibility
scrollbarVisibility controls when the scrollbar shows: always (the default), auto to reveal it
only while hovering or scrolling, or never to hide it entirely while keeping the content scrollable.
This example uses auto — hover the area to reveal the bar.
RTL
Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a
container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your
tree in DirectionProvider so direction-aware behavior follows the same direction.
The vertical scrollbar moves to the start (left) edge and horizontal scrolling begins from the right, following the resolved direction. The scroll-shadow mask mirrors to fade the matching edges. For setup details and caveats, see the RTL guide.
API reference
ScrollArea wraps Base UI's Scroll Area and forwards ref and remaining ScrollArea.Root props. Its parts carry data-slot attributes (scroll-area, scroll-area-viewport, scroll-area-content, scroll-area-scrollbar, scroll-area-thumb, scroll-area-corner) for targeted styling.
Accessibility
- Built on Base UI's Scroll Area, which keeps the content in a native scroll container — so mouse wheel, trackpad, touch, and keyboard scrolling (arrows, Page Up/Down, Home/End) all work as users expect; only the scrollbar's appearance is custom.
- The scroll viewport is focusable so keyboard users can scroll overflowing content, with a visible focus ring.
- The custom scrollbar and thumb are decorative — assistive tech navigates the content directly rather than the bar.
- Set a
scrollbarVisibilityother thanneverwhen scrolling isn't otherwise discoverable; hiding the bar entirely can make overflow easy to miss.