Scroll Area

A region with custom scrollbars.

Default

Give the root a fixed height. The overlay scrollbar stays hidden until you hover or scroll, so it never takes width from the content.

Fade

Pass scrollFade to fade only the edges that hide content. Each fade clears as the viewport reaches that edge.

Max height

Put a max height on viewportClassName instead of a height on the root. The area hugs short content and scrolls once it passes the cap.

Horizontal

Content wider than the root scrolls sideways. With scrollFade, the left and right edges fade instead.

Best practices

When to use

  • Use when a bounded panel needs its own scrolling, such as a long menu list, a transcript pane or a side panel.
  • Avoid nested scrolling in ordinary page content; let the page scroll whenever possible.

Behavior

  • Give the root a fixed height, or put a max height on viewportClassName (for example max-h-48) so short content hugs and long content scrolls.
  • Add scrollFade whenever content is clipped; it fades only the edges that hide content.
  • The overlay scrollbar appears on hover or scroll and never takes width from the content.

Accessibility

  • Keep focused descendants scrolled into view, and do not put the only copy of required content below the fold.