Skip to main content

Overview

Scroll Area wraps a scrollable container with a styled, cross-browser-consistent scrollbar. Use it to replace native OS scrollbars in sidebars, lists, code blocks, and chat windows.

Installation


Usage


Variants

Vertical Scroll

Horizontal Scroll

With ScrollBar Visibility


API Reference

ScrollArea

string
default:"hover"
When to show the scrollbar. Values: auto · always · scroll · hover
number
default:"600"
Milliseconds before the scrollbar hides after scrolling stops (when type="scroll").
string
Additional class names for the outer container. Use this to set height and width.

ScrollBar

string
default:"vertical"
Scrollbar direction. Values: vertical · horizontal

Accessibility

  • ScrollArea uses overflow: scroll under the hood — the content remains keyboard scrollable
  • Keyboard users can scroll with Arrow keys, Page Up/Down, and Home/End when the scroll area is focused
  • Screen readers interact with the content inside ScrollArea directly — no special ARIA attributes are needed
  • Ensure the scroll container has a set height/width — without bounds it will expand to fit content and never scroll

Do’s & Don’ts

Do

  • Always set an explicit height (or max-height) on the ScrollArea
  • Add <ScrollBar orientation="horizontal" /> explicitly for horizontal scrolling
  • Use type="always" for sidebars so users always know the list is scrollable
  • Use inside bounded containers: sidebars, modals, cards

Don't

  • Don’t use ScrollArea for full-page scroll — use native page scroll instead
  • Don’t nest multiple ScrollAreas — outer and inner scroll compete on trackpad
  • Don’t forget to set height — without it, the area will never scroll
  • Don’t use for tables — use sticky headers with native table scroll instead