Skip to content

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.json

Vertical

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

Files to copy

3 folders · 1 file · 3 packages
From theme/src/
  • components/scroll-area/
  • lib/cn.ts
  • styles/
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.ts
  • lib/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.

Both directions

A wide table in a fixed box. scrollbars="always" keeps the bars visible.

ScrollArea

PropTypeDefaultDescription
overflowEdgeThresholdnumber | Partial<{ xStart: number; xEnd: number; yStart: number; yEnd: number; }>1The threshold in pixels that must be passed before the overflow edge attributes are applied. Accepts a single number for all edges or an object to configure them individually.
childrenReactNodeNoneHolds the content that scrolls.
styleCSSPropertiesNoneSets the inline styles for the root element.
classNamestringNoneRoot element: give it a height (vertical) or width (horizontal).
orientation"horizontal" | "vertical" | "both""vertical"Which way the content scrolls.
fade"mask" | "none" | "shadow""mask"How the edges show there is more content.
fadeSizenumber32Length of the edge fade, in px.
scrollbars"always" | "hover""hover""hover" (default): scrollbars appear on hover / scroll / focus. "always": always shown.
labelstringNoneAccessible name for the scrollable region (adds role="region").
viewportClassNamestringNoneAdds classes to the scrolling element (Base UI Viewport).
contentClassNamestringNoneAdds classes to the content wrapper inside the viewport.
viewportRefRef<HTMLDivElement>NoneRef to the scrolling element, e.g. to scroll programmatically.

Keyboard

KeysAction
Arrow keys, Page Up/Page Down, Home/End, SpaceScroll the focused area natively.
TabThe viewport is focusable only while it can scroll, so keyboard users can reach it.

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

67 components pages in all: browse them on All components.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .