Shadcn Scroll Area Components

A scroll area is a container that allows the user to scroll through a large amount of content. Each scroll area variant functions identically with Radix UI and Base UI. Browse our collection of 6 Shadcn Scroll Area variants.

Tags

v1.2.0-beta.50
v1.2.0-beta.49
v1.2.0-beta.48
v1.2.0-beta.47
v1.2.0-beta.46
v1.2.0-beta.45
v1.2.0-beta.44
v1.2.0-beta.43
v1.2.0-beta.42
v1.2.0-beta.41
v1.2.0-beta.40
v1.2.0-beta.39
v1.2.0-beta.38
v1.2.0-beta.37
v1.2.0-beta.36
v1.2.0-beta.35
v1.2.0-beta.34
v1.2.0-beta.33
v1.2.0-beta.32
v1.2.0-beta.31
v1.2.0-beta.30
v1.2.0-beta.29
v1.2.0-beta.28
v1.2.0-beta.27
v1.2.0-beta.26
v1.2.0-beta.25
v1.2.0-beta.24
v1.2.0-beta.23
v1.2.0-beta.22
v1.2.0-beta.21
v1.2.0-beta.20
v1.2.0-beta.19
v1.2.0-beta.18
v1.2.0-beta.17
v1.2.0-beta.16
v1.2.0-beta.15
v1.2.0-beta.14
v1.2.0-beta.13
v1.2.0-beta.12
v1.2.0-beta.11
v1.2.0-beta.10
v1.2.0-beta.9
v1.2.0-beta.8
v1.2.0-beta.7
v1.2.0-beta.6
v1.2.0-beta.5
v1.2.0-beta.4
v1.2.0-beta.3
v1.2.0-beta.2
v1.2.0-beta.1

With sheet

User list

Users

JD

John Doe

john.doe@example.com

SM

Sarah Miller

sarah.miller@example.com

MJ

Mike Johnson

mike.johnson@example.com

EW

Emma Wilson

emma.wilson@example.com

DB

David Brown

david.brown@example.com

LA

Lisa Anderson

lisa.anderson@example.com

CT

Chris Taylor

chris.taylor@example.com

AM

Amy Martinez

amy.martinez@example.com

RG

Ryan Garcia

ryan.garcia@example.com

JL

Jessica Lee

jessica.lee@example.com

Sticky header

Today

Chris Tompson requested review on PR #42: Feature implementation.

15 minutes ago

Emma Davis shared New component library.

45 minutes ago

James Wilson assigned you to API integration task.

4 hours ago

Alex Morgan replied to your comment in Authentication flow.

12 hours ago

Yesterday

Sarah Chen commented on Dashboard redesign.

2 days ago

Robert Kim approved your changes in Payment gateway PR.

3 days ago

This Week

Miky Derya mentioned you in shadcnuikit.com open graph image.

2 weeks ago

Laura Martinez created new issue: Bug in user authentication.

5 days ago

Daniel Park merged your pull request: Dark mode implementation.

1 week ago

Olivia Brown requested changes on Mobile responsive design PR.

1 week ago

Last Week

Michael Chen commented on Database migration strategy.

2 weeks ago

Sophia Lee tagged you in Performance optimization discussion.

3 weeks ago

David Johnson closed issue: Memory leak in image processing.

3 weeks ago

Older

Emily White updated documentation: API endpoint reference.

1 month ago

Thomas Anderson deployed new version: v2.3.0 to production.

1 month ago

Horizontal

EM
Elon Musk
OC
Olivia Carter
AT
Azumi Tanaka
XE
Xander Ellis
TB
Theo Black
DG
David Gilmore
GW
Gerard White
SM
Sophia Martinez
JW
James Wilson
EB
Emma Brown

SM
Sarah Miller9:15 AM
Hey! Are we still on for the meeting tomorrow?
Y
You9:18 AM
Yes, absolutely! 2 PM works for me.
SM
Sarah Miller9:20 AM
Perfect! I'll send the agenda later today.
MJ
Mike Johnson10:30 AM
Can I join the meeting as well?
Y
You10:32 AM
Of course! The more the merrier.
EW
Emma Wilson11:45 AM
I've prepared the presentation slides. Should I share them now?
Y
You11:47 AM
Yes please, that would be great!
DB
David Brown2:20 PM
Just reviewed the slides. They look excellent!
SM
Sarah Miller3:00 PM
Thanks everyone for the quick responses. See you all tomorrow!
Y
You3:02 PM
Looking forward to it!
Unlock premium components
Get full control of shadcn/ui components, blocks and instances, including future additions.

Explore Shadcn Blocks

Ready-made page sections built with the same components.

View all blocks

Shadcn Scroll Area Component

The Shadcn Scroll Area is a container with a fixed height or width that scrolls its content while showing a thin, custom styled scrollbar. It keeps long lists, chat histories and side panels inside their box, so the rest of the layout stays in place, and it looks the same on every browser and operating system.

A chat thread that jumps to the newest message, notifications with sticky date headers, a sideways row of avatars and a privacy policy inside a sheet show where a shadcn scroll area earns its place. Radix UI and Base UI both provide the primitive underneath, which keeps native scrolling and draws the custom scrollbar on top, and the styling comes from shadcn/ui, React and Tailwind CSS.

What is the Shadcn Scroll Area Component?

The shadcn/ui scroll area wraps your content in a viewport element that uses the browser's real scrolling, then hides the default scrollbar and draws its own track and thumb. Because scrolling stays native, touch gestures, trackpad momentum, mouse wheels and keyboard scrolling all behave as users expect, and the thumb size and position are kept in sync with the content.

Use a scroll area when a region of the page must have a fixed size and its own scrollbar, such as a sidebar list or a message thread. If the whole page scrolls, the browser scrollbar is enough. To show only part of a long text with a Show more toggle, a Collapsible is simpler, and for sliding through cards one at a time, use a Carousel.

Anatomy of the Shadcn Scroll Area

PartDescription
ScrollAreaThe root. It renders the scrolling viewport, a vertical scrollbar and the corner piece. Give it a height (or width for horizontal content) through className.
ScrollBarThe custom track and rounded thumb. A vertical one is included by default; add <ScrollBar orientation="horizontal"/> inside the ScrollArea for sideways scrolling.

6 Shadcn Scroll Area Variants

Each scroll area variant listed here is previewed live at the top of this page, together with its source code and install command.

  • Basic list: A bordered box with a Tags heading and fifty version tags divided by separators, the classic vertical example.
  • With sheet: A long privacy policy inside a side sheet. The sheet is a flex column and the ScrollArea uses min-h-0 and flex-1, so the header and policy text scroll inside the panel instead of overflowing the screen.
  • User list: A scrolling list of users with avatars, names and email addresses in a fixed height panel.
  • Sticky header: Notifications grouped by date, with each date label sticking to the top of the viewport while its group scrolls.
  • Horizontal: A row of profile avatars with names and a colored ring for active users, kept on one line with whitespace-nowrap and scrolled sideways with a horizontal ScrollBar.
  • Chat: A message thread built with Bubble and a composer pinned below it. An effect sets the viewport scrollTop to its scrollHeight, so the area jumps to the newest message whenever one is sent.

How to Install the Shadcn Scroll Area Component

Set up shadcn/ui in your project if you have not already, then add the Shadcn UI Kit registry to your components.json once:

{
  "registries": {
    "@shadcnuikit": "https://shadcnuikit.com/r/{name}.json"
  }
}

Then install a scroll area variant by its name:

npx shadcn@latest add @shadcnuikit/scroll-area1

The same command works with pnpm dlx, yarn dlx and bunx --bun. Each variant has a copy button for every package manager, and the code is added to your project as plain React and Tailwind CSS that you can edit freely.

How to Use the Shadcn Scroll Area Component

Wrap the content in ScrollArea and give it a fixed height. The content inside scrolls; everything outside stays still.

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

const releases = Array.from({ length: 30 }, (_, i) => `v2.${30 - i}.0`)

export function ReleaseList() {
  return (
    <ScrollArea className="h-72 w-56 rounded-md border">
      <div className="p-4">
        <h4 className="mb-4 text-sm font-medium">Releases</h4>
        {releases.map((release) => (
          <div key={release}>
            <div className="text-sm">{release}</div>
            <Separator className="my-2" />
          </div>
        ))}
      </div>
    </ScrollArea>
  )
}

Why Use the Shadcn Scroll Area Component

  • Consistent scrollbars: The same thin scrollbar on Windows, macOS and Linux, styled with your theme colors.
  • Native scrolling feel: Wheel, trackpad, touch and keyboard scrolling stay native, so nothing feels emulated.
  • Stable layouts: Long content stays inside its box, so headers, footers and sidebars do not move.
  • Both directions: Vertical by default, horizontal with one extra ScrollBar, or both at once.
  • Works with sticky content: Sticky headers and footers inside the viewport behave like they do in a normal page.

Common Scroll Area Use Cases

  • Sidebars: Navigation lists and file trees that scroll independently of the page.
  • Chat windows: Message history in a fixed panel with the input pinned below.
  • Notification panels: Activity feeds in a popover or dropdown grouped by date.
  • Long text in overlays: Terms, policies and release notes inside a sheet or drawer.
  • Horizontal galleries: Stories, avatars, tags or product thumbnails in a single row.
  • Code and logs: Wide code blocks and log output that need horizontal and vertical scrolling.

Customizing the Shadcn Scroll Area

Size and borders go on ScrollArea through className, and padding belongs on an inner wrapper so the scrollbar stays at the edge. The thumb uses the border color token, so it follows your theme and dark mode; you can tune the palette with the free Theme Generator. With Radix UI, the type prop decides when the scrollbar is visible: hover (the default), scroll, auto or always.

For horizontal scrolling, prevent wrapping and add a horizontal scrollbar:

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

export function TagRow({ tags }: { tags: string[] }) {
  return (
    <ScrollArea className="w-96 rounded-md border whitespace-nowrap">
      <div className="flex w-max gap-4 p-4">
        {tags.map((tag) => (
          <span key={tag} className="text-sm">
            {tag}
          </span>
        ))}
      </div>
      <ScrollBar orientation="horizontal" />
    </ScrollArea>
  )
}

Scroll Area Accessibility and Keyboard Support

The content lives in a real scrolling viewport, so screen readers read it in order and assistive technology can scroll it like any other region. The custom scrollbar is not keyboard focusable. Keyboard users scroll by tabbing to focusable elements inside the area, which scrolls them into view, or, in current browsers, by focusing the scrollable viewport itself, which shows a focus ring in this implementation.

If the scroll area holds an important region, such as a chat log, give it an accessible name with aria-label and a suitable role. Keep the area large enough to show several items at once, and avoid nesting scroll areas in the same direction. The scrolling keys below are handled natively by the browser while the viewport has focus.

KeyAction
TabMoves focus to the next focusable item inside the area, or to the viewport itself when the browser makes it focusable.
ArrowDownScrolls down when the viewport has focus.
ArrowUpScrolls up when the viewport has focus.
ArrowLeft / ArrowRightScrolls sideways in a horizontal scroll area.
PageDownScrolls down by one view height.
PageUpScrolls up by one view height.
HomeScrolls to the top of the content.
EndScrolls to the bottom of the content.

Scroll Area Best Practices

  • Always give the scroll area a fixed height or max height; without it, it grows with the content and never scrolls.
  • Put padding on an inner element, not on the ScrollArea, so the scrollbar is not pushed inward.
  • Show a hint that more content exists, such as a partially visible last item or a fade at the edge.
  • Do not wrap the entire page in a scroll area; let the browser handle page scrolling.
  • In a flex column, add min-h-0 and flex-1 so the area can shrink and scroll, as in the sheet variant.
  • For a scrolling list of rows, combine it with the Item component for consistent spacing.

Components Related to Scroll Area

Shadcn Scroll Area FAQ

Add <ScrollBar orientation="horizontal" /> inside the ScrollArea, give the area a width and add whitespace-nowrap, then place the items in a flex row with w-max so they do not wrap.

The ScrollArea needs a fixed height or max height, for example h-72. Inside a flex column, also add min-h-0 and flex-1, otherwise the area grows with its content and there is nothing to scroll.

Get the viewport element, which has data-slot="scroll-area-viewport", and set its scrollTop to its scrollHeight in an effect whenever new content arrives. The chat variant on this page uses this approach.

With Radix UI, pass type="always" to ScrollArea. The default type="hover" shows the scrollbar only while the pointer is over the area.

Give each header sticky top-0 and a background such as bg-background/80 with backdrop-blur-sm. The scroll area viewport is the scrolling container, so each header sticks to its top while its group scrolls underneath, as in the notifications variant on this page.

Looking for something else? Browse all shadcn/ui components or ready-made UI blocks built with them.