✨ Working with PDFs, images or videos? Discover 145+ free web apps built for everyday tasks

Scroll Area

Provides styled scrolling for constrained content regions. Supports vertical, horizontal, and both-axis scrolling with auto-hide or always-visible scrollbar strategies.

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>
);
}