Skip to main content

Starwind UI v3.0 is now available! Migration guide

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

ScrollArea provides the viewport, content wrapper, vertical scrollbar, thumb, and corner. The rendered structure is:

ScrollArea
├── ScrollAreaViewport
│ └── ScrollAreaContent
├── ScrollBar
│ └── ScrollAreaThumb
└── ScrollAreaCorner

Pass a custom scrollbar through the framework-specific API:

---
import { ScrollArea, ScrollBar } from "@/components/starwind/scroll-area";
---
<ScrollArea>
Scrollable content
<ScrollBar slot="scrollbar" orientation="horizontal" />
</ScrollArea>

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

Styled Component API

These props are added or materially changed by the installed styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Expand a prop to see named type definitions and framework-specific imports. Follow the Primitive and Runtime links for lower-level behavior props.

Scroll Area

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
overflowEdgeThreshold number
Description
Sets the distance from an edge that counts as overflow.
Classification
Primitive override
Primitive prop
scroll-area.Root.overflowEdgeThreshold
viewportClass string
Description
Adds classes to the generated viewport element.
Classification
Wrapper prop

Primitive And Runtime API

Use these references when you need the lower-level behavior APIs behind Scroll Area.

Runtime API

Scroll Area primitive
createScrollArea from @starwind-ui/runtime/scroll-area

Changelog

View version history v2.0.1 3 releases

v2.0.1

  • Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly.

v2.0.0

  • Rebuilt Scroll Area on Starwind Runtime with viewport, content, scrollbar, thumb, and corner anatomy.
  • See the Scroll Area Primitive for the underlying unstyled anatomy and behavior API.

v1.0.0

  • Initial Release with Starwind v2.0.0