Scroll Area

A region that scrolls with the platform's own scrolling and an overlay scrollbar: a 4 px #c8c8c8 thumb that floats over the content's edge, never takes its space, and fades out when you stop scrolling and the pointer leaves.

BetaReady to use. Its API can still change in a minor release; the changelog says when.

import { ScrollArea } from "@leap-crm/design-system";

Playground

Change a prop and the component follows. Its code is under Props.

  • Activity 1
  • Activity 2
  • Activity 3
  • Activity 4
  • Activity 5
  • Activity 6
  • Activity 7
  • Activity 8
  • Activity 9
  • Activity 10
  • Activity 11
  • Activity 12

Props

horizontal

Best practices

When to use it, and the rules that apply in particular places.

GuidancePractice
DoUse it for every region that scrolls, like a contact's activity or a long list in a panel. The scrollbar floats over the content and takes none of its width.
DoGive it a height, a max-h-* or a flex-1 parent in a dialog or drawer body. Without one it grows with its content and never scrolls.
DoSet inList inside a menu or listbox, so the area is never a tab stop between the list and its rows.
DoSet aria-label, like "Activity", when the region holds focusable content of its own, so a keyboard user knows where they are.
Don'tUse overflow-auto or overflow-scroll. The operating system draws its own track, which takes width from the content, and lint rejects it.
Don'tSet horizontal to fit a wide table into a narrow panel when the columns could wrap or drop. Sideways scrolling hides columns the reader can't tell are there.

Props

ScrollArea takes ui-sdk's Scroll Area options: type (hover by default, or scroll, auto, always), scrollHideDelay, stickToEnd and controller.

ScrollArea

PropTypeDefaultDescription
childrenReactNode—What it shows inside.
classNamestring—Classes added to the root element, merged with its own. Tokens only.
scrollbarClassNamestring—Classes for the vertical scrollbar, like a top inset under a sticky header.
horizontalbooleanfalseAdds a horizontal scrollbar, for content wider than the area.
aria-labelstring—Names the scrollable region when it holds focusable content of its own, like "Activity".
inListbooleanfalseSet inside a menu or listbox that moves its own highlight. Its arrow keys already scroll the highlight into view, so the area never becomes a tab stop, and it joins the list as an unnamed group so the list's structure stays valid (a focusable box isn't allowed between a list and its rows).

ScrollBar

PropTypeDefaultDescription
classNamestring—Classes added to the root element, merged with its own. Tokens only.
orientationunknown"vertical"

Code

What the playground shows, ready to copy.

import { ScrollArea } from "@leap-crm/design-system";

<ScrollArea className="h-40" aria-label="Activity">
  {activity}
</ScrollArea>

Keyboard

The keys it answers to. Tab moves between components, arrows move within them.

KeysWhat they do
TabGoes to the content: a scroll area with focusable content is no tab stop itself.