Skip to main content

Starwind UI v3.0 beta is now available! Read the migration guide

Scroll Area

Installation

Framework Availability

Astro Available React Available

Scroll Area is available for Astro and React.

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

Styled Component API

These props are added or materially changed by the installed Astro styled component. Standard HTML attributes remain available through the inherited interfaces noted below. 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

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