Search documentation

Search components and pages

Scroll Area

Augments native scroll for custom styling.

Installation

Add the scroll area component with the shadcn CLI.

npx shadcn@latest add https://yami.ui.unsanity.ai/r/scroll-area.json

Usage

import { ScrollArea } from "@/components/ui/scroll-area"

<ScrollArea className="h-40 w-56 border border-border p-3">
  <div className="space-y-2 text-sm">
    {items.map((item) => (
      <p key={item.id} className="text-muted-foreground">{item.label}</p>
    ))}
  </div>
</ScrollArea>

Examples

Default

Code

import { ScrollArea } from "@/components/ui/scroll-area"

<ScrollArea className="h-40 w-56 border border-border p-3">
  <div className="space-y-2 text-sm">
    {items.map((item) => (
      <p key={item.id} className="text-muted-foreground">{item.label}</p>
    ))}
  </div>
</ScrollArea>