Shadcn Scroll Area
A cross-browser styled scroll container (ScrollAreaBlock) supporting vertical, horizontal (with mouse-wheel panning), and dual-axis scrollbars plus minimal, glass, and autoHide modes.
About Shadcn Scroll Area
What it is. ScrollAreaBlock styles vertical, horizontal, and two-axis scrollbars consistently across WebKit and Firefox with default, minimal, and glass variants plus autoHide and hideTrack.
How it is built. Scopes scrollbar styling to a generated class so global page scrollbars are unaffected, and supports wheelToHorizontal so vertical mouse-wheel input pans horizontal rows cleanly until hitting an edge.
When to use it. Use ScrollAreaBlock inside fixed-height lists, chat threads, code viewers, and horizontal card rails.
For AI agents
Hand your agent this brief or the Markdown page, not a screenshot.
When to use
- Bounded vertical, horizontal, or two-axis scroll containers with consistent cross-browser scrollbars (
default,minimal,glass,autoHide)
When not to use
- Virtualized huge datasets — pair with a virtualizer if rendering thousands of rows
Agent notes
- Named export:
import { ScrollAreaBlock } from "@/components/custom/blocks/ScrollAreaBlock" - Always pass a height/width constraint via
className(andw-maxon inner content fororientation="horizontal")
For AI agents3 variants. Ask the user which one.
Ask before you pick. This page has 3 variants. If the user has not named one and has not asked you to choose for them, ask which they want before you install anything or write code, and show every option with its live link. If they ask you to choose, pick from each variant's best-for and avoid-if lines against their brief, and say why. If the user named a variant, use it and do not ask.
All 3 options as live previews: https://avaraui.com/view/scroll-area
When to use it. A scroll container with a custom, cross-browser scrollbar built in pure CSS, in three styles: the default, a slim minimal bar and a tinted glass bar.
Gotchas
- All three are looks of the one `scroll-area` item: install it once and set `variant` from the index.
- The container needs a height or width constraint, or there is nothing to scroll.
- Direction is `orientation` (vertical, horizontal or both) and fading the bar out is `autoHide`: both are props on any style.
The 3 variants
Default default
The standard custom scrollbar, styled to match your theme.
- Best for: a general scrollable panel, list or code area
- Avoid if: the space is dense and a slimmer bar would suit better
- Traits: default look, vertical, horizontal or both axes
- Install:
npx shadcn@latest add @avara-ui/scroll-area - Docs section
Minimal minimal
The thumb is slimmed down for dense interfaces.
- Best for: tables, menus and dense UI where the scrollbar should take little room
- Avoid if: a thin bar would be hard to grab
- Traits: slim thumb
- Install:
npx shadcn@latest add @avara-ui/scroll-area - Docs section
Glass glass
The bar is tinted for use over frosted surfaces.
- Best for: scroll areas inside glass panels or over imagery
- Avoid if: the surface is plain and solid
- Traits: tinted bar for frosted backgrounds
- Install:
npx shadcn@latest add @avara-ui/scroll-area - Docs section
- Markdown
- /docs-md/nextjs-scroll-area.md
- Install
npx shadcn@latest add https://avaraui.com/r/scroll-area.json- Registry name
@avara-ui/scroll-area, through the shadcn MCP server- Index
- llms.txt lists every page, or add the agent skill once
Props Reference
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
ScrollAreaBlock | variant | "default" | "minimal" | "glass" | "default" | Determines the architectural style and thickness of the scroll track and thumb. |
ScrollAreaBlock | color | "indigo" | "rose" | "emerald" | "zinc" | string | "primary" | The color of the scrollbar thumb and hover states. Fully supports dynamic custom hex codes. |
ScrollAreaBlock | orientation | "vertical" | "horizontal" | "both" | "vertical" | Defines which axis should be scrollable. This automatically applies the correct CSS overflow utilities. |
ScrollAreaBlock | hideTrack | boolean | false | If true, forces the background scroll track to be completely transparent, showing only the thumb. |
ScrollAreaBlock | autoHide | boolean | false | If true, the scrollbar thumb fades to transparent when the container is not being actively hovered. |
ScrollAreaBlock | wheelToHorizontal | boolean | true |
|
Works with other components
- Embed
ScrollAreaBlockinside Resizable, Drawer, and Command Palette lists.
How do I add a custom scrollbar with Tailwind and React?
Wrap the content in ScrollAreaBlock and give it a bounded height or width, then choose a variant of "default", "minimal" or "glass". It styles vertical, horizontal and two-axis scrollbars the same way in WebKit browsers and Firefox.
Why isn't my horizontal ScrollAreaBlock scrolling?
orientation defaults to "vertical", so set orientation="horizontal" (or "both") for sideways scrolling. The content inside must also be wider than the container, for example a flex row that does not wrap, or there is nothing to scroll.
How do I make the mouse wheel scroll sideways?
wheelToHorizontal is true by default and only applies when orientation="horizontal". A vertical wheel then pans the row sideways until it reaches an edge. Trackpad swipes and shift+wheel keep their normal behaviour, and you can pass false to turn it off.
How do I hide the scrollbar until the user hovers?
Set autoHide so the thumb fades to transparent when the container is not hovered. Add hideTrack to make the background track fully transparent so only the thumb shows. Both props are false by default and work with any variant.
Will ScrollAreaBlock change my page's global scrollbar?
No. Its scrollbar styling is scoped to a generated class on that one container, so the page scrollbar and other scrollers are untouched. Use color ("indigo", "rose", "emerald", "zinc" or a custom colour string) to tint the thumb and its hover state.