Skip to main content

Overview

Scroll Area provides custom, cross-browser styled scrollbars while maintaining native scroll behavior.

Features

  • Scrollbar sits on top of the scrollable content
  • Scrolling is native; no underlying position changes
  • Custom cross-browser styling
  • Supports both horizontal and vertical scrolling
  • Supports automatic hiding of scrollbars

Installation

Anatomy

API Reference

Root

Contains all the parts of a scroll area.
'auto' | 'always' | 'scroll' | 'hover'
default:"'hover'"
Describes the nature of scrollbar visibility.
  • auto - Scrollbars are visible when content overflows
  • always - Scrollbars are always visible
  • scroll - Scrollbars are visible when scrolling
  • hover - Scrollbars are visible when hovering over the scroll area
number
default:"600"
Time in milliseconds before the scrollbars hide after the user stops interacting with scrollbars.
'ltr' | 'rtl'
The reading direction of the scroll area. If omitted, inherits globally from DirectionProvider or assumes LTR.

Viewport

The viewport area of the scroll area.

Scrollbar

The vertical or horizontal scrollbar.
'vertical' | 'horizontal'
default:"'vertical'"
The orientation of the scrollbar.
boolean
Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.

Thumb

The thumb to be used in a scrollbar.

Corner

The corner where both vertical and horizontal scrollbars meet.

Examples

Basic Usage

Always Visible

Data Attributes

Scrollbar

  • data-state - "visible" or "hidden"
  • data-orientation - "vertical" or "horizontal"

Thumb

  • data-state - "visible" or "hidden"

CSS Variables

Root

  • --radix-scroll-area-corner-width - The width of the corner
  • --radix-scroll-area-corner-height - The height of the corner