Native scrolling with a minimal scrollbar, edges that fade only where there’s more to see, and an optional peek that cuts the last item in half.
Install
Add it to your project
Run this in a project set up for shadcn/ui. It writes the files and installs the npm packages.
First time: connect the Infinity UI registry
- Create a personal token on your Tokens page.
- Put it in
.env.localasINFINITYUI_TOKEN. - Add the registry to
components.json:
{
"registries": {
"@infinityui": {
"url": "https://infinityui.io/r/{name}.json",
"headers": {
"Authorization": "Bearer ${INFINITYUI_TOKEN}"
}
}
}
}Using Claude Code, Codex, Cursor, Lovable or v0? See CLI & MCP for a setup prompt.
npm packages it adds
- cn
- @base-ui/react
- class-variance-authority
Code
import { ScrollArea } from "@/components/ui/scroll-area"
const names = [
"Olivia Martin",
"Jackson Lee",
"Isabella Nguyen",
"William Kim",
"Sofia Davis",
"Liam Patel",
"Emma Garcia",
"Noah Wilson",
]
const roles = ["Design", "Engineering", "Product", "Support"]
const people = Array.from({ length: 40 }, (_, index) => ({
id: index + 1,
name: names[index % names.length],
role: roles[index % roles.length],
}))
export function ScrollAreaDemo() {
return (
<ScrollArea peek className="h-80 w-full max-w-sm rounded-lg border">
<ul className="flex flex-col gap-1 p-2">
{people.map((person) => (
<li
key={person.id}
className="flex items-center justify-between gap-3 rounded-md px-3 py-2.5 text-sm hover:bg-muted"
>
<span className="truncate font-medium">
{person.id}. {person.name}
</span>
<span className="text-muted-foreground">{person.role}</span>
</li>
))}
</ul>
</ScrollArea>
)
}
































