Scroll Area
Thin neon scrollbar with edge fades that appear only when needed.
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/scroll-area.jsonUsage
import { ScrollArea } from "@/components/ui/scroll-area"
<ScrollArea aria-label="Changelog" className="h-80 rounded-xl border border-white/10">
…
</ScrollArea>Examples
Horizontal
The bar overlays the content, so leave a little padding under it. Wheel input over the bar scrolls sideways.
Both axes
Long lines scroll sideways while the log scrolls down.
Scrollbar visibility
API reference
Also accepts native div attributes, which go to the root along with ref. Size the root with className.
| Prop | Type | Default |
|---|---|---|
orientation | "vertical"Which axes scroll. | "vertical" |
scrollbar | "hover"hover: while the pointer is over it or it's scrolling. auto: whenever the content overflows. always: the track stays visible even without overflow. | "hover" |
fade | booleanMask the edges that have more content past them. A number sets the fade length in pixels (default 24). | true |
viewportClassName | stringClasses for the scrolling viewport. | None |
viewportRef | Ref<HTMLDivElement>The scrolling element, for scrollTo() and scroll position. | None |
onScroll | UIEventHandler<HTMLDivElement>Fires when the viewport scrolls. | None |
aria-label | stringNames the viewport and gives it role="region". aria-labelledby works the same way. | None |
color | NeonColorThumb glow on hover and drag. Falls back to --neon-accent, then cyan. | inherited |
Accessibility
- Scrolling stays native: the viewport is a real overflow container, so wheel, trackpad, touch and keyboard scrolling behave exactly as the browser does.
- When the content overflows and has nothing focusable inside, the viewport joins the tab order so keyboard users can scroll it with the arrow keys, Page Up and Page Down, Home and End.
- The custom thumb is hidden from assistive tech, as native scrollbars are. Drag it, or press the track to jump there and keep dragging.
- Pass aria-label when the content needs a name, such as a changelog or a log viewer. The viewport becomes a named region.