Skip to main content

Starwind UI v2.0 is now available! With new color-picker and more components

Scroll Area

Installation

Usage

---
import { ScrollArea, ScrollBar } from "@/components/starwind/scroll-area";
---
<ScrollArea class="h-[200px] w-[350px] rounded-md border p-4">
Your scrollable content here.
</ScrollArea>

Composition

Use the following composition to build a ScrollArea:

ScrollArea
└── ScrollBar

Examples

Horizontal

Use ScrollBar with orientation="horizontal" for horizontal scrolling.

RTL

You can enable RTL behavior by placing the component inside a container with dir="rtl".

API Reference

ScrollArea

The root scroll container with a viewport and optional custom scrollbar slot.

PropTypeDefault
viewportClassstring-
classstring-
<ScrollArea class="h-72 rounded-md border p-4" viewportClass="pr-2">
Content
</ScrollArea>

Additional Notes:

  • viewportClass: Applies classes to the internal scrollable viewport element
  • Supports standard div attributes such as id, dir, and aria-*
  • Includes a default vertical ScrollBar through the named scrollbar slot

ScrollBar

Custom scrollbar element for ScrollArea.

PropTypeDefault
orientation"vertical" | "horizontal""vertical"
classstring-
<ScrollArea class="w-96 rounded-md border">
<div class="w-max p-4">Horizontal content</div>
<ScrollBar slot="scrollbar" orientation="horizontal" />
</ScrollArea>

Additional Notes:

  • Render with slot="scrollbar" when overriding default scrollbar behavior

Changelog

v1.0.0

  • Initial Release with Starwind v2.0.0