Scroll Area
A wrapper that hides the native scrollbar and paints its own overlay one — a rounded, fading, draggable thumb. Content scrolls natively (wheel, trackpad, touch, and keyboard), so this is a purely cosmetic layer; set orientation to pick which axes get a thumb and maxHeight to cap the viewport.
Installation
Copy the piece into your app — it compiles with your build and the code is yours:
puzzle add piece scroll-area
Requires the pieces.css tokens merged into your app styles (see Introduction).
Usage
import ScrollArea from '@/components/ui/ScrollArea.pzl';
<ScrollArea maxHeight={ 256 } label="Ingredients" class="w-72 rounded-lg border border-border bg-surface"></ScrollArea>Horizontal
Both axes
Accessibility
Scrolling stays native, so keyboard and screen-reader support come for free — the custom thumb is purely decorative on top:
- Native scroll — wheel, trackpad, and touch are untouched; the thumb only mirrors the position
- Keyboard — the viewport takes
tabindex="0"only while it overflows, so arrow keys, Page Up / Page Down, Space, and Home / End scroll it once focused - Landmark — pass
labeland the viewport becomes arole="region"a screen-reader user can enter by name - Decorative thumb — the bar is
aria-hidden; it is draggable with a pointer but never focusable - Reduced motion — the fade-in / fade-out honors
prefers-reduced-motion