Component guideEditable source

Scroll Area

A bounded scrolling region with theme-aware scrollbars.

Original component docs
On this page4 sectionsBack to top

Use Scroll Area when a panel needs its own scrollable content. Set a height or maximum height so there is something to scroll. Do not replace ordinary page scrolling without a clear layout need.

Live preview
Loading preview...

#Installation

Complete the base setup. For manual installation:

npx shadcn@latest add @neobrutal-ui/scroll-area

#Usage

import { ScrollArea } from "@/components/ui/scroll-area";

export default function ActivityList() {
  return (
    <ScrollArea
      className="h-48 w-full max-w-sm rounded-base border-2 border-border"
      aria-label="Recent activity"
    >
      <ul className="space-y-3 p-4">
        {Array.from({ length: 12 }, (_, index) => (
          <li key={index}>Workspace update {index + 1}</li>
        ))}
      </ul>
    </ScrollArea>
  );
}

#API reference

Prop / partPurposeDefault
ScrollArea.classNameRoot bounds and layoutUnbounded unless styled
ScrollArea.aria-label / aria-labelledbyName the focusable scrolling regionUnset
ScrollArea.overflowEdgeThresholdThreshold for native overflow-edge state0
ScrollBar.orientationVertical or horizontal scrollbarvertical
ScrollBar.keepMountedKeep a scrollbar mounted without overflowfalse
ChildrenContent inside the viewportRequired for useful scrolling

#Accessibility

An aria-label or aria-labelledby names the viewport and exposes it as a region. Base UI manages its keyboard focusability when content overflows.

Ensure keyboard users can reach and scroll the region. Name substantial regions and do not trap wheel or touch scrolling unnecessarily. Horizontal content needs a matching horizontal scrollbar and a clear cue that more content exists.