Make your AI a shadcn expert

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.

Scroll to load preview...

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

ScrollBar

Horizontal

Add ScrollBar with orientation="horizontal". Keep the inner row w-max so items do not wrap.

Scroll to load preview...

RTL

Wrap with DirectionProvider and dir="rtl". The scrollbar sits on the start edge.

Scroll to load preview...

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.

KeyAction
Arrow keysNudge the focused viewport
Page Up / Page DownJump by a page
Home / EndStart / end of the content
SpacePage 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

Questions

Was this page helpful?

Sign in to leave feedback.