Layout/Scroll Area

Scroll Area

Augments native scroll functionality for custom styling.

Themed

When to Use

Use Scroll Area when you need to:

  • Display long lists, logs, or text content in a fixed-height container
  • Provide custom-styled scrollbars that match your design system
  • Create horizontal scrolling galleries or carousels without native scrollbar aesthetics
  • Contain overflowing content in sidebars, panels, or modals
  • Support both vertical and horizontal scrolling in data-heavy layouts

When Not to Use

  • Full-page scrolling -- use native browser scroll instead
  • Content that should be fully visible -- avoid hiding content behind scroll when space allows
  • Single-line horizontal overflow -- consider text-ellipsis or a Tooltip
  • Paginated data -- use Pagination or Data Table for large datasets

Vertical List

Scrollable list with custom styled scrollbar. Set an explicit height on the container for vertical scrolling to activate.

Tags

v1.2.0-beta.50
v1.2.0-beta.49
v1.2.0-beta.48
v1.2.0-beta.47
v1.2.0-beta.46
v1.2.0-beta.45
v1.2.0-beta.44
v1.2.0-beta.43
v1.2.0-beta.42
v1.2.0-beta.41
v1.2.0-beta.40
v1.2.0-beta.39
v1.2.0-beta.38
v1.2.0-beta.37
v1.2.0-beta.36
v1.2.0-beta.35
v1.2.0-beta.34
v1.2.0-beta.33
v1.2.0-beta.32
v1.2.0-beta.31
v1.2.0-beta.30
v1.2.0-beta.29
v1.2.0-beta.28
v1.2.0-beta.27
v1.2.0-beta.26
v1.2.0-beta.25
v1.2.0-beta.24
v1.2.0-beta.23
v1.2.0-beta.22
v1.2.0-beta.21
v1.2.0-beta.20
v1.2.0-beta.19
v1.2.0-beta.18
v1.2.0-beta.17
v1.2.0-beta.16
v1.2.0-beta.15
v1.2.0-beta.14
v1.2.0-beta.13
v1.2.0-beta.12
v1.2.0-beta.11
v1.2.0-beta.10
v1.2.0-beta.9
v1.2.0-beta.8
v1.2.0-beta.7
v1.2.0-beta.6
v1.2.0-beta.5
v1.2.0-beta.4
v1.2.0-beta.3
v1.2.0-beta.2
v1.2.0-beta.1

Horizontal Scrolling

Horizontal scroll area for galleries or wide content. Add a ScrollBar with orientation='horizontal' and use whitespace-nowrap on the container.

Photo by Ornella Binni
Photo by Tom Byrom
Photo by Vladimir Malyavko
Photo by Laura Vinck

Text Content

Scrollable text content area for articles, documentation, or long descriptions within constrained space.

Jokester began sneaking into the castle in the middle of the night and leaving jokes all over the place: under the king's pillow, in his soup, even in the royal toilet. The king was furious, but he couldn't seem to stop Jokester.

And then, one day, the people of the kingdom discovered that the jokes left by Jokester were so funny that they couldn't help but laugh. And once they started laughing, they couldn't stop.

The kingdom became known as the happiest place in the land, all thanks to Jokester's midnight joke deliveries. The king eventually came to appreciate the humor and even invited Jokester to become the royal court jester.

From that day forward, laughter echoed through the castle halls, and the kingdom prospered in ways no one could have imagined.

Always Visible Scrollbar

Use type='always' to keep scrollbars visible at all times, making it clear the content is scrollable.

Item 1
Description
Item 2
Description
Item 3
Description
Item 4
Description
Item 5
Description
Item 6
Description
Item 7
Description
Item 8
Description
Item 9
Description
Item 10
Description
Item 11
Description
Item 12
Description
Item 13
Description
Item 14
Description
Item 15
Description
Item 16
Description
Item 17
Description
Item 18
Description
Item 19
Description
Item 20
Description

Both Axes

Scroll area supporting both vertical and horizontal scrolling. Useful for wide tables or grid content in constrained containers.

NameRoleDepartmentStatusLocation
User 1EngineerProductActiveRemote
User 2EngineerProductActiveRemote
User 3EngineerProductActiveRemote
User 4EngineerProductActiveRemote
User 5EngineerProductActiveRemote
User 6EngineerProductActiveRemote
User 7EngineerProductActiveRemote
User 8EngineerProductActiveRemote
User 9EngineerProductActiveRemote
User 10EngineerProductActiveRemote
User 11EngineerProductActiveRemote
User 12EngineerProductActiveRemote
User 13EngineerProductActiveRemote
User 14EngineerProductActiveRemote
User 15EngineerProductActiveRemote

UX & Design Guidelines

Visual Hierarchy

Scroll areas should have clear boundaries using border border-border and rounded-md to signal containment. The scrollbar thumb uses bg-border for subtlety, becoming more visible on hover. Use type="always" when discoverability of hidden content is critical.

Spacing & Layout

Always set explicit dimensions on the ScrollArea container ( h-72, h-[200px]). Apply padding to the inner content wrapper rather than the ScrollArea itself to avoid clipping scrollbar tracks. Use p-4 on the child container for consistent content insets.

Responsive Behavior

On mobile, the scrollbar is narrower (2.5 units wide) for minimal visual footprint. Consider using percentage-based or viewport-relative heights ( h-[50vh]) for responsive scroll containers. Horizontal scroll areas should use whitespace-nowrap with touch-friendly scrollbar sizing.

Color & Contrast

The scrollbar thumb uses the bg-border semantic token, which adapts to light and dark mode automatically. Scrollbar tracks use transparent borders ( border-l-transparent) for clean alignment. The custom scrollbar provides consistent styling across browsers while maintaining sufficient contrast for visibility.

Accessibility

Keyboard Navigation

  • Tab -- Move focus into the scroll area viewport
  • Arrow Up / Arrow Down -- Scroll vertically when the viewport is focused
  • Arrow Left / Arrow Right -- Scroll horizontally when a horizontal scrollbar is present
  • Page Up / Page Down -- Scroll by one viewport height
  • Home / End -- Jump to the start or end of the scrollable content

Screen Reader Support

  • The viewport is focusable and announces its scrollable nature to assistive technology
  • Custom scrollbars are purely decorative -- screen readers use native scroll semantics
  • Use aria-label on the ScrollArea to describe its content region
  • For live-updating content (e.g., chat logs), add aria-live="polite" or role="log"

Focus Management

The viewport uses focus-visible:ring-[3px] with ring-ring/50 for a visible focus indicator. Focus is applied to the viewport element, not the outer container, so keyboard users can immediately scroll. The focus ring inherits the container's border radius via rounded-[inherit].

RTL Support

Set dir="rtl" on the ScrollArea to enable right-to-left scroll behavior. Horizontal scrollbars will reverse direction to match the reading order. Content within the scroll area should also be set to RTL for consistent layout.

ARIA Attributes

{/* Standard scrollable region with accessible label */}
<ScrollArea className="h-72 w-48 rounded-md border" aria-label="Version tags">
  {/* Content */}
</ScrollArea>

{/* Scroll area within a labeled section */}
<section aria-labelledby="notifications-heading">
  <h2 id="notifications-heading">Notifications</h2>
  <ScrollArea className="h-[300px]">
    {/* Notification list */}
  </ScrollArea>
</section>

{/* Scroll area with role and description */}
<ScrollArea
  className="h-[200px]"
  role="log"
  aria-label="Activity log"
  aria-live="polite"
>
  {/* Live-updating log content */}
</ScrollArea>

API Reference

The ScrollArea component accepts the following props in addition to standard div attributes.

PropTypeDefaultDescription
type"auto" | "always" | "scroll" | "hover""hover"Determines when scrollbars are visible. 'auto' shows when content overflows, 'always' keeps them visible, 'scroll' shows on scroll, 'hover' shows on hover.
scrollHideDelaynumber600Duration in milliseconds before scrollbars auto-hide after the user stops scrolling. Only applies when type is 'scroll' or 'hover'.
dir"ltr" | "rtl""ltr"The reading direction of the scroll area. Affects horizontal scroll behavior.
classNamestringAdditional CSS classes to apply to the scroll area container.

ScrollBar

The ScrollBar sub-component controls individual scrollbar tracks. A vertical ScrollBar is rendered by default.

PropTypeDefaultDescription
orientation"vertical" | "horizontal""vertical"The axis the scrollbar controls. A vertical ScrollBar is included by default.
forceMountbooleanfalseWhen true, forces the scrollbar to render even when content does not overflow.
classNamestringAdditional CSS classes to apply to the scrollbar element.