A scroll area with a scrollbar in your theme colors. It is a server component with no JavaScript: one shared stylesheet, the variant and modes live in data attributes.
Browser Support
Colors the scrollbar
Controls scrollbar width
Reserves space for the scrollbar
Colors the scrollbar thumb and track
Preview
Three variants. The switch turns auto-hide on for all of them. On macOS overlay scrollbars the track is not drawn.
Default
- Anna10:02
Did you see the new build?
- Max10:04
Yes, the review is almost done
- Anna10:05
Great, I will merge after lunch
- Ivan10:11
Can someone check the staging deploy?
- Max10:12
On it, give me five minutes
- Max10:19
Staging is green, no errors in the logs
- Olga10:26
Updated the pricing page copy
- Anna10:27
Looks good, thanks!
- Ivan10:41
Release notes are in the doc
- Olga10:43
Added a screenshot to the changelog
- Max10:50
Let's ship it tomorrow morning
- Anna10:52
Agreed, I will post the announcement
Minimal
- Today
Design
12 files
- Mon
roadmap-2026.pdf
2.4 MB
- Mon
hero-banner.png
860 KB
- Sun
Invoices
38 files
- Sat
brand-guidelines.pdf
5.1 MB
- Fri
team-photo.jpg
3.2 MB
- Fri
meeting-notes.md
14 KB
- Thu
Archive
104 files
- Wed
logo-dark.svg
6 KB
- Wed
contract-draft.docx
212 KB
- Tue
Screenshots
57 files
- Tue
budget-q4.xlsx
420 KB
Primary
- Anna Petrova2 min
commented on your pull request
- GitHub14 min
Build #482 passed
- Max Orlov32 min
mentioned you in #design
- Billing1 h
Invoice for November is ready
- Olga Smirnova2 h
invited you to the Launch project
- Vercel3 h
Deployment is live on production
- Ivan Kuznetsov5 h
liked your comment
- SecurityYesterday
New sign-in from Chrome on macOS
- Anna PetrovaYesterday
shared the file roadmap-2026.pdf
- CalendarYesterday
Planning starts in 15 minutes
- SupportMon
Your request #1204 is resolved
- Max OrlovMon
assigned you a task
Installation
Usage
import { ScrollContainer } from "@/components/ui/scroll-container"
<ScrollContainer height="20rem">
<div className="p-4 space-y-4">
{/* Your scrollable content */}
</div>
</ScrollContainer>Examples
Auto-hide scrollbar
<ScrollContainer height="16rem" autoHide>
{/* Scrollbar appears on hover and focus, hidden otherwise */}
</ScrollContainer>Variants
<ScrollContainer variant="default" />
<ScrollContainer variant="minimal" />
<ScrollContainer variant="primary" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| height | string | number | "100%" | Container height, number in px or any CSS length |
| autoHide | boolean | false | Show the scrollbar only on hover or focus, with a fade. Touch screens always show it |
| variant | "default" | "minimal" | "primary" | "default" | default: thumb muted-foreground/50 on a muted track. minimal: thin translucent thumb without a track (4px in the Safari fallback). primary: thumb in the primary color |
| forceVisible | boolean | false | Reserve space for the scrollbar with scrollbar-gutter: stable. Does not make overlay scrollbars permanent |
| ref | Ref<HTMLDivElement> | - | Ref to the scrolling div |
| className | string | - | Additional CSS classes |