Scroll Area

@sushindustries/ui

The named inner scroll: thin bar, and the smooth scroller handed back - the pair everyone forgets separately.

4 min read
View as MarkdownEdit on GitHub

ScrollArea wraps a bounded region - a changelog panel, a code block, a list inside a card - in the site's thin scrollbar, and hands the wheel back to the page's smooth scroller the moment the cursor leaves it. Reach for it whenever a piece of content needs its own scroll, not the page's.

Viewport width
Phone22remthe floor, the narrowest this promises to work at
tanstacktanstack add https://adamjurek.com/r/tanstack/scroll-area.jsonshadcnpnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/scroll-area.json

Why it is built this way

Two behaviours were being forgotten separately often enough to earn one name: the site's thin scrollbar styling, and data-lenis-prevent, which tells the smooth scroller to leave this subtree's wheel and touch events alone. Skip either one and the region either looks like an unstyled native scrollbar or fights the page for the same gesture.

Install

tanstack add https://adamjurek.com/r/tanstack/scroll-area.json
shell
pnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/scroll-area.json
shell
pnpm add @sushindustries/ui @sushindustries/atoms
shell

What you get

Version0.1.0
Categorylayout · Containers
Filesscroll-area.tsx
DependenciesNone
Tagsscroll, lenis, no-deps

No runtime dependencies

It brings nothing with it beyond the stylesheet.