Design System
Data display

Scroll area

Confine tall content to a fixed height with a slim, styled scrollbar that looks the same on every platform.

Purpose

Use it where a list must not push the page taller — a panel of clinics inside a card, for instance. Do not wrap the whole page in one.

Example

Panel clinics near Bangsar

Klinik Mediviron, Bangsar

Poliklinik Kuala Lumpur, Brickfields

Qualitas Medical, Mid Valley

Klinik Kesihatan Cheras

BP Healthcare, Bangsar South

Klinik Alpro, Taman Tun Dr Ismail

Poliklinik Segar, Pantai Dalam

Klinik Kita, Seputeh

Klinik Mediviron, Kerinchi

Qualitas Medical, Old Klang Road

Horizontal

The default scrollbar is vertical. For content that scrolls sideways, add the exported ScrollBar with orientation="horizontal" and let the content set its own width (w-max).

GP visits
Dental
Optical
Specialist
Maternity
Wellness
Hospitalisation

For wide tables you do not need this — Table's container already scrolls horizontally.

Structure

The tokens behind the region.

PropertyValue
Heightnone of its own — set the fixed height on ScrollArea via className
Viewportfills the container (size-full), inherits the container's radius
Focusviewport shows a 2px --ring outline when focused via keyboard
Scrollbar10px track (w-2.5 vertical, h-2.5 horizontal), 1px padding
Thumb--border fill, pill radius

Best practices

Do

  • Set the fixed height (or width) on ScrollArea itself; the viewport fills it.
  • Precede the region with a heading naming the content, so users know what they are scrolling.
  • Keep it for panels inside a layout — lists in cards, sidebars, long menus.

Don't

  • Wrap the whole page — the browser's own scrolling is better at that in every way.
  • Nest scroll areas; inner ones trap the wheel and confuse focus.
  • Hide the only path to a critical action below the fold of a short scroll region.

Accessibility & keyboard

A fixed-height scroll region is a keyboard trap in waiting: if nothing inside is focusable, a keyboard-only user has no way to scroll it. This component defuses that — the viewport ships with tabIndex={0}, so the region itself is always reachable with Tab (WCAG 2.1.1; axe's scrollable-region-focusable rule).

  • Tab reaches the viewport even when the content holds no focusable elements; a 2px --ring outline shows where you are.
  • Keyboard: with the viewport (or anything inside it) focused — ↑/↓ scroll by line, PageUp / PageDown by viewport, Home / End to the ends; ←/→ scroll horizontally when a horizontal ScrollBar is in play.
  • The scrollbar and thumb are pointer affordances only (touch-none select-none) — keyboard users scroll the viewport, never the scrollbar.
  • Content order is unchanged — screen readers read straight through the region; the fixed height is purely visual.

Props

ScrollArea wraps the Radix ScrollArea root and accepts its props unchanged — type ("hover", "always", "scroll", "auto"), scrollHideDelay and dir — plus any HTML attribute. ScrollBar accepts the Radix scrollbar props, most usefully orientation.

Scroll area in Storybook

On this page