Shadcn Scroll Area
React scroll area for overflow lists and image galleries. Built with TypeScript and Tailwind CSS for Next.js using Base UI — custom scrollbars, native wheel and touch.
A scroll area is a sized box with styled scrollbars and native overflow. Give it a height — or a width for a row — and drop content in. Use it for tag lists, sidebars, image strips, and any panel that should not grow the page.
Looking for a neobrutalism version for shadcn?
Same scroll area, thicker borders. The NeoBrutalism scroll area is the kit if you want that look.
Usage
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"<ScrollArea className="h-[200px] w-[350px] rounded-md border p-4">
Your scrollable content here.
</ScrollArea>The box only scrolls after you give it a size. A vertical ScrollBar is already inside the root; add another with orientation="horizontal" for a row.
Composition
Horizontal
Add ScrollBar with orientation="horizontal". Keep the inner row w-max so items do not wrap.
RTL
Wrap with DirectionProvider and dir="rtl". The scrollbar sits on the start edge.
API
Prop
Type
ScrollBar
Prop
Type
ScrollArea and ScrollBar take className. The viewport and corner are not exported.
Keyboard
Scrolling is native. Focus the viewport, then the usual keys work.
| Key | Action |
|---|---|
| Arrow keys | Nudge the focused viewport |
Page Up / Page Down | Jump by a page |
Home / End | Start / end of the content |
Space | Page down |
Exact keys follow the OS. There is no extra listener.
Notes
The box needs a size
The viewport is size-full. Without h-72, max-h-*, or a flex parent that already has a height, the content just grows and no bar appears.
The scrollable node is the viewport ([data-slot="scroll-area-viewport"]), not the root. scrollTop on a ref to ScrollArea does nothing.
With other components
Rows in the list
CardFrame around the box
TableWide overflow
DialogLong modal body
SheetSide panel list
CommandPalette overflow
Questions
Related
Was this page helpful?
Sign in to leave feedback.
Resizable
React resizable for dashboards and split editors. Built with TypeScript and Tailwind CSS for Next.js using Base UI — drag handles, nested groups, and RTL.
Select
React select for theme, status, and timezone pickers. Built with TypeScript and Tailwind CSS for Next.js using Base UI — grouped options and typeahead search.