Scroll Area with Custom Scrollbars for React
A React scroll area that keeps native scrolling but adds slim custom scrollbars in glass, with edges that fade only where there is more to see.
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/scroll-area.jsonVertical
The top edge stays crisp until you scroll; the bottom fades while there is more. Tab to the list and use the arrow keys.
Release notes
import { ScrollArea } from "@/components/sheenui/scroll-area/scroll-area";
// Package build (after the first npm release, or a packed tarball): import { ScrollArea } from "@sheenui/theme";
const releases = [
{ version: "2.14.0", notes: "Stepper and Timeline." },
{ version: "2.13.0", notes: "Data table density." },
{ version: "2.12.0", notes: "Side drawer." },
];
export function Example() {
// Round it like its card: the keyboard focus ring follows the radius.
return (
<ScrollArea className="h-72 rounded-b-sheen-lg" label="Release notes">
<ul>{releases.map((r) => <li key={r.version}>
<b>{r.version}</b> {r.notes}
</li>)}</ul>
</ScrollArea>
);
}Files to copy
3 folders · 1 file · 3 packages
- From
theme/src/ components/scroll-area/lib/cn.tsstyles/
- shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/scroll-area.jsonRegistry item: scroll-area. The styles need the Tailwind v4 glass UI setup.- The examples also use
components/glass-card/hooks/{use-media-query.ts, use-preferences.ts}motion/light-follower.tslib/heading.ts
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/glass-card.json- Packages
pnpm add @base-ui/react clsx tailwind-merge
Horizontal, with glass inside
Scroll shadows instead of a mask, so the cards keep their blur.
import { GlassCard } from "@/components/sheenui/glass-card/glass-card";
import { ScrollArea } from "@/components/sheenui/scroll-area/scroll-area";
// Package build (after the first npm release, or a packed tarball): import { GlassCard, ScrollArea } from "@sheenui/theme";
// This example also uses glass-card: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/glass-card.json
const themes = ["Aurora", "Liquid", "Midnight", "Paper", "Sunset", "Mono"];
export function Example() {
// Glass cards inside: use the "shadow" fade (a mask would stop their blur), and level 1 for a long
// strip of small tiles (it has no blur of its own, so six tiles in view stay inside the glass budget).
return (
<ScrollArea orientation="horizontal" fade="shadow" label="Recently viewed">
<ul className="flex w-max gap-3">
{themes.map((t) => <li key={t}><GlassCard level={1} className="w-44 p-4">
{t}
</GlassCard></li>)}
</ul>
</ScrollArea>
);
}Both directions
A wide table in a fixed box. scrollbars="always" keeps the bars visible.
import { GlassCard } from "@/components/sheenui/glass-card/glass-card";
import { ScrollArea } from "@/components/sheenui/scroll-area/scroll-area";
// Package build (after the first npm release, or a packed tarball): import { GlassCard, ScrollArea } from "@sheenui/theme";
// This example also uses glass-card: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/glass-card.json
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
const regions = [
"Amsterdam", "Bengaluru", "Cape Town", "Dublin", "Frankfurt", "Jakarta", "London", "Montréal", "Mumbai", "Oregon",
"Osaka", "Paris", "São Paulo", "Seoul", "Singapore", "Stockholm", "Sydney", "Tokyo", "Virginia", "Zürich",
];
export function Example() {
return (
<GlassCard className="w-full max-w-2xl overflow-hidden p-0">
<ScrollArea orientation="both" className="h-80 rounded-sheen-lg" scrollbars="always" label="Usage by region">
<table className="w-max text-start [:where(&)_th]:text-start text-sm">
<thead className="text-xs text-sheen-fg-muted">
<tr>
<th scope="col" className="px-4 py-3 font-medium">
Region
</th>
{months.map((m) => (
<th key={m} scope="col" className="px-4 py-3 text-end font-medium">
{m}
</th>
))}
</tr>
</thead>
<tbody>
{regions.map((region, r) => (
<tr key={region} className="border-t border-sheen-border">
<th scope="row" className="px-4 py-2.5 font-medium whitespace-nowrap">
{region}
</th>
{months.map((m, c) => (
<td key={m} className="px-4 py-2.5 text-end text-sheen-fg-muted tabular-nums">
{(((r + 3) * (c + 7) * 37) % 900) + 100}
</td>
))}
</tr>
))}
</tbody>
</table>
</ScrollArea>
</GlassCard>
);
}ScrollArea
Keyboard
Accessibility
- Scrolling stays native (wheel, touch, keys, find-in-page); the viewport gets a name from label and role="region".
- Scrollbars appear on hover, while scrolling and while the viewport has keyboard focus; the focus ring is drawn inside the edge.
- The edge fades are decorative. Use fade="shadow" when glass cards sit inside, so their blur is not masked.
When to use the scroll area
- Use it as a React scroll area for a fixed-height list inside a card, such as a notification list or a long set of options, where you want slim glass scrollbars instead of the browser's chunky default. It draws a glass scrollbar in CSS that matches the theme, instead of the browser default.
- Use orientation="horizontal" for a row of cards or chips that scrolls sideways, with fade="shadow" so the glass cards inside keep their backdrop blur.
- Use orientation="both" for a wide table in a fixed box with scrollbars="always", when users must see at a glance that the content continues in both directions.
- Skip it when the whole page scrolls; let the browser handle it. For a long list of thousands of rows, the windowed Chat list, which renders only the visible rows, or a paginated Data table is a better fit than scrolling a plain container.
- Pair it with GlassCard as the container, Separator between sections of the scrolled content, and Skeleton to hold the layout while the content loads.
Frequently asked questions
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .