Scroll Area
Custom scrollable container with spring-expanded hover thumbs, overflow-aware edge fade masks, keyboard focusability, and optional scroll-progress bar.
Customize
Installation
Add the base scrollable container:
npx shadcn@latest add @kinetic/scroll-areaAdd the optional scroll progress indicator when you want a reading or list progress bar:
npx shadcn@latest add @kinetic/scroll-progressUsage
Native wheel, touch, and keyboard scrolling remain intact while ScrollArea draws an auto-hiding thumb that expands with SPRING.snappy on fine-pointer hover or drag. Viewport scrollbars are hidden using Tailwind utilities without injecting any <style> tags.
import { ScrollArea } from "@/components/kinetic/ui/scroll-area";
interface ChangelogFeedProps {
readonly items: readonly string[];
}
export function ChangelogFeed({ items }: ChangelogFeedProps) {
return (
<ScrollArea className="h-64 w-full rounded-lg border border-border">
<div className="divide-y divide-border p-4">
{items.map((item) => (
<div key={item} className="py-2 text-sm text-muted-foreground">
{item}
</div>
))}
</div>
</ScrollArea>
);
}Scroll progress indicator
Place ScrollProgress from @kinetic/scroll-progress inside ScrollArea to read scroll progress automatically, or bind it to an external targetRef or window.
import { ScrollArea } from "@/components/kinetic/ui/scroll-area";
import { ScrollProgress } from "@/components/kinetic/ui/scroll-progress";
interface TrackedScrollListProps {
readonly rows: readonly string[];
}
export function TrackedScrollList({ rows }: TrackedScrollListProps) {
return (
<div className="space-y-2">
<ScrollArea className="h-60 rounded-lg border border-border">
<ScrollProgress className="sticky top-0 z-20 rounded-none" />
<div className="p-4">
{rows.map((row) => (
<p key={row} className="py-1.5 text-sm">
{row}
</p>
))}
</div>
</ScrollArea>
</div>
);
}API Reference
ScrollArea
Native overflow viewport with spring-widened thumb scrollbar and inline maskImage edge fades.
| Prop | Type | Default | Description |
|---|---|---|---|
edgeFade / fadeSize | boolean / number | true / 24 | Fades only edges with remaining overflow and syncs matching scroll-padding. |
hideDelayMs / speed | number / number | 900 / 1 | Idle delay before hiding scrollbars and spring expansion speed multiplier. |
showVerticalScrollbar / showHorizontalScrollbar | boolean / boolean | true / false | Controls which custom scrollbars are rendered. |
ScrollProgress
Separate registry effect (@kinetic/scroll-progress) tracking scroll ratio inside ScrollArea, targetRef, or window.
| Prop | Type | Default | Description |
|---|---|---|---|
axis / decorative | "y" | "x" / boolean | "y" / false | Tracked scroll axis and decorative vs accessible progressbar mode. |