A native scroll container with custom scrollbars.
import { ScrollArea } from "@/components/ui/scroll-area";<ScrollArea className="h-64 rounded-md border">
<ScrollAreaContent className="p-4">
Just as suddenly as it had begun, the sensation stopped, leaving Alice
feeling slightly disoriented. She looked around and realized that the room
hadn't changed at all - it was she who had grown smaller, shrinking down to
a fraction of her previous size. Alice felt herself growing larger and
larger, filling up the entire room until she feared she might burst. The
sensation was both thrilling and terrifying, as if she were expanding beyond
the confines of her own body. She wondered if this was what it felt like to
be a balloon, swelling with air until it could hold no more.
</ScrollAreaContent>
</ScrollArea>The scroll shadows are the small gradient backgrounds that appear at the top and bottom (vertical) or left and right (horizontal) of the scroll area when scrolling. They are useful to indicate that the scroll area is scrollable.
You can control the scroll shadows using the scrollShadow prop. It can be set to vertical, horizontal, both, or none. The default value is none.
<ScrollArea
scrollShadow="vertical"
>
<ScrollAreaContent>
<div>
<p>Vertical scroll shadow</p>
</div>
</ScrollAreaContent>
</ScrollArea>