Scroll Area

A React scroll area on Base UI with slim custom scrollbars that hide until you scroll, for vertical, horizontal, or two way overflow panels and lists.

Loading preview

Examples

Practical examples and common states for the same installable component.

Vertical

Scrolls content along the vertical axis.

examples/scroll-area-vertical.tsx
import { ScrollArea } from "@/components/wensity/scroll-area";
const items = ["Profile", "Security & Privacy", "Notifications", "Billing & Plans", "API Tokens", "Team Members", "Audit Log", "Sessions"];
export function ScrollAreaVertical() {
return (
<div className="w-[320px] rounded-2xl border bg-card p-4 shadow-sm">
<ScrollArea orientation="vertical" className="h-56">
<div className="flex flex-col gap-0.5 pr-3">
{items.map((item) => (
<div key={item} className="flex items-center gap-3 rounded-lg px-3 py-2 text-[13px] hover:bg-muted transition-colors">
<div className="size-2 rounded-full bg-muted-foreground/30 shrink-0" />
<span>{item}</span>
</div>
))}
</div>
</ScrollArea>
</div>
);
}

Horizontal

Scrolls content along the horizontal axis.

examples/scroll-area-horizontal.tsx
import { ScrollArea } from "@/components/wensity/scroll-area";
const tags = ["React", "TypeScript", "Tailwind CSS", "Next.js", "Framer Motion", "PostgreSQL", "Redis", "Docker"];
export function ScrollAreaHorizontal() {
return (
<div className="w-[440px] rounded-2xl border bg-card p-4 shadow-sm">
<ScrollArea orientation="horizontal">
<div className="flex gap-2 py-1 w-max">
{tags.map((tag) => (
<span key={tag} className="shrink-0 rounded-md bg-muted px-3 py-1.5 text-[12px] whitespace-nowrap">
{tag}
</span>
))}
</div>
</ScrollArea>
</div>
);
}

Both Axes

Supports scrolling across both axes simultaneously.

examples/scroll-area-both.tsx
import { ScrollArea } from "@/components/wensity/scroll-area";
const cards = ["Analytics", "Dashboard", "Settings", "Messages", "Calendar", "Tasks", "Files", "Teams"];
export function ScrollAreaBoth() {
return (
<div className="w-[400px] rounded-2xl border bg-card p-4 shadow-sm">
<ScrollArea orientation="both" className="h-48">
<div className="grid grid-cols-3 gap-2 p-0.5 min-w-[480px]">
{cards.map((item) => (
<div key={item} className="flex flex-col items-center justify-center gap-1.5 rounded-lg bg-muted/50 p-3">
<div className="size-7 rounded-md bg-muted-foreground/15" />
<span className="text-[11px] text-muted-foreground">{item}</span>
</div>
))}
</div>
</ScrollArea>
</div>
);
}

Auto Hide

Reveals scrollbars only during hover or focus interaction.

examples/scroll-area-auto-hide.tsx
import { ScrollArea } from "@/components/wensity/scroll-area";
const items = ["Profile", "Security & Privacy", "Notifications", "Billing & Plans", "API Tokens", "Team Members", "Audit Log", "Sessions"];
export function ScrollAreaAutoHide() {
return (
<div className="w-[320px] rounded-2xl border bg-card p-4 shadow-sm">
<ScrollArea orientation="vertical" hideScrollbar="auto" className="h-56">
<div className="flex flex-col gap-0.5 pr-3">
{items.map((item) => (
<div key={item} className="flex items-center gap-3 rounded-lg px-3 py-2 text-[13px] hover:bg-muted transition-colors">
<div className="size-2 rounded-full bg-muted-foreground/30 shrink-0" />
<span>{item}</span>
</div>
))}
</div>
</ScrollArea>
</div>
);
}

Always Visible

Keeps scrollbars persistently visible regardless of interaction.

examples/scroll-area-always-visible.tsx
import { ScrollArea } from "@/components/wensity/scroll-area";
const items = ["Profile", "Security & Privacy", "Notifications", "Billing & Plans", "API Tokens", "Team Members", "Audit Log", "Sessions"];
export function ScrollAreaAlwaysVisible() {
return (
<div className="w-[320px] rounded-2xl border bg-card p-4 shadow-sm">
<ScrollArea orientation="vertical" hideScrollbar="never" className="h-56">
<div className="flex flex-col gap-0.5 pr-3">
{items.map((item) => (
<div key={item} className="flex items-center gap-3 rounded-lg px-3 py-2 text-[13px] hover:bg-muted transition-colors">
<div className="size-2 rounded-full bg-muted-foreground/30 shrink-0" />
<span>{item}</span>
</div>
))}
</div>
</ScrollArea>
</div>
);
}

Overview

Scroll Area is a React and Tailwind CSS scroll container on Base UI, in Next.js or any React app, that swaps the system scrollbar for a slim custom one while keeping native scrolling underneath. orientation turns on vertical, horizontal, or both scrollbars, with a corner piece when both are shown, and hideScrollbar keeps them hidden until you hover or scroll, or always visible. The viewport is focusable, so keyboard users can scroll it with arrow keys. Give the root a fixed height or max height through className, because a scroll area with no limit simply grows.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add scroll-area

Usage

Import ScrollArea from @/components/wensity/scroll-area and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { ScrollArea } from "@/components/wensity/scroll-area";
const items = ["Profile", "Security", "Notifications", "Billing", "API Tokens", "Teams", "Audit Log", "Sessions"];
export function ScrollAreaDemo() {
return (
<div className="w-[320px] rounded-2xl border bg-card p-4 shadow-sm">
<ScrollArea orientation="vertical" className="h-64">
<div className="flex flex-col gap-0.5 pr-3">
{items.map((item) => (
<div key={item} className="flex items-center gap-3 rounded-lg px-3 py-2 text-[13px] hover:bg-muted transition-colors">
<div className="size-2 rounded-full bg-muted-foreground/30 shrink-0" />
<span>{item}</span>
</div>
))}
</div>
</ScrollArea>
</div>
);
}

Props

PropTypeDefaultDescription
orientation"vertical" | "horizontal" | "both""vertical"Which axes may scroll.
hideScrollbar"auto" | "never""auto"auto fades the scrollbar out when idle; never keeps it visible.
  • Scroll Stack component preview

    Scroll Stack

    Cards that pin, tilt, and stack into a tidy deck as you scroll, with zero scroll hijacking anywhere in the sequence.

  • Infinite Marquee component preview

    Infinite Marquee

    A seamless, GPU-only logo strip that never stutters or snaps at the loop point.

  • Color Archive Scroll component preview

    Color Archive Scroll

    An endless project list that repaints the whole stage in the active row's color, with a preview card you can drag.

  • Apple-Style Sticky Scroll component preview

    Apple-Style Sticky Scroll

    A pinned cinematic section that morphs in lock-step with scroll, staying perfectly in sync whichever way you travel.