oakoss/ui
Components

Scroll Area

A region that scrolls its content with thin native scrollbars.

Source

Tags

v1.30.0
v1.29.0
v1.28.0
v1.27.0
v1.26.0
v1.25.0
v1.24.0
v1.23.0
v1.22.0
v1.21.0
v1.20.0
v1.19.0
v1.18.0
v1.17.0
v1.16.0
v1.15.0
v1.14.0
v1.13.0
v1.12.0
v1.11.0
v1.10.0
v1.9.0
v1.8.0
v1.7.0
v1.6.0
v1.5.0
v1.4.0
v1.3.0
v1.2.0
v1.1.0

Installation

npx shadcn@latest add @oakoss/scroll-area

Usage

import { ScrollArea } from '#/components/ui/layout/scroll-area';

<ScrollArea aria-label="Tags" className="h-72">
  …
</ScrollArea>;

Examples

Horizontal

orientation="horizontal" scrolls sideways only; vertical scrolls up and down only, and the default, both, scrolls either way. Content that overflows the other way is clipped.

  • Aurora
  • Basalt
  • Cedar
  • Delta
  • Ember
  • Fjord

Accessibility

The scrollbars are the browser's own, so touch, wheel, keyboard and assistive technology scroll it as they would any page. While its content overflows, the area is focusable, so keyboard users can tab to it and scroll with the arrow keys, and up and down with Page Up, Page Down, Home and End; content that fits adds no tab stop. Its focus ring sits inside its edge, where a clipping parent can't hide it. React Aria adds no keys.

Give it a name (aria-label or aria-labelledby), so screen readers announce what the focused area holds; a named area is a region while it scrolls. The thumb is the input border color, which meets 3:1 against the page, and forced colors repaint the scrollbar and the focus ring in system colors.

API

ScrollArea

A div that scrolls its content. Size it with className (h-72); the scrollbars appear only when the content overflows.

Props

Prop

Type

Also accepts div props.

Data attributes

AttributePresent when
data-slotAlways: scroll-area
data-orientationAlways: both, horizontal or vertical