Scrollable item 1
Scrollable item 2
Scrollable item 3
Scrollable item 4
Scrollable item 5
Scrollable item 6
Scrollable item 7
Scrollable item 8
Scrollable item 9
Scrollable item 10
Scrollable item 11
Scrollable item 12
Scrollable item 13
Scrollable item 14
Scrollable item 15

Scroll Area

A custom scrollable container with styled scrollbars.

A scrollable area with custom-styled scrollbars.

Usage

import { ScrollArea } from "@delphi/ui";

export function Example() {
  return (
    <ScrollArea className="h-72 w-48 rounded-md border">
      <div className="p-4">
        {/* Long content here */}
      </div>
    </ScrollArea>
  );
}

Critical: Height Requirements

ScrollArea's internal Viewport uses h-full w-full, which means it needs an explicit height on the ScrollArea container to work properly.

Inside overflow-hidden containers

When using ScrollArea inside components with overflow-hidden (like DropdownMenuSubContent, PopoverContent, Command), you must use an explicit fixed height:

// ✅ CORRECT - explicit height
<DropdownMenuSubContent className="p-0">
  <ScrollArea className="h-72">
    <div className="p-1">{/* content */}</div>
  </ScrollArea>
</DropdownMenuSubContent>

// ❌ WRONG - h-auto with max-height doesn't work
<DropdownMenuSubContent className="p-0">
  <ScrollArea className="h-auto max-h-72">
    <div className="p-1">{/* content */}</div>
  </ScrollArea>
</DropdownMenuSubContent>

Why? The Viewport's h-full needs a real pixel height to reference. When the parent has overflow-hidden, using h-auto max-h-* doesn't give the Viewport a concrete height to fill, so scrolling breaks.

API Reference

PropTypeDefaultDescription
type"auto" | "always" | "scroll" | "hover""hover"When scrollbar is visible
scrollHideDelaynumber600Delay before hiding scrollbar in ms
dir"ltr" | "rtl"-Reading direction
Use ScrollArea for custom-styled scrollbars that match your design
Set an explicit fixed height (e.g., h-72) — especially inside overflow-hidden containers
Consider type="always" to show scrollbar presence
Test keyboard scrolling and focus behavior
Ensure content is reachable via keyboard navigation
Use h-auto max-h-* inside overflow-hidden containers — it won't scroll
Use ScrollArea when native scrolling is sufficient
Nest multiple scroll areas — it's confusing
Hide scrollbars completely — users need visual feedback
Make scroll areas too small to be usable
ESC
No results found