shadcn.io is an independent project built on shadcn/ui
A panel holds a table of 20 people. The columns are Name, Email, Role, Department, Location and Status. The panel scrolls vertically and horizontally.
Scroll both ways when a table has more columns and rows than the panel. A Table that drops columns is easier if a sideways scroll is awkward. Base UI in React does not build the rows.
Installation
Anatomy

Usage
<ScrollArea className="h-[400px] w-full max-w-md rounded-md border bg-background">
<div className="w-max p-4">
<table className="w-full">
<thead>
<tr className="border-b">
<th className="px-4 py-2 text-start font-medium">Name</th>
<th className="px-4 py-2 text-start font-medium">Email</th>
<th className="px-4 py-2 text-start font-medium">Role</th>
<th className="px-4 py-2 text-start font-medium">Department</th>
<th className="px-4 py-2 text-start font-medium">Location</th>
<th className="px-4 py-2 text-start font-medium">Status</th>
</tr>
</thead>
<tbody>
{members.map((member) => (
<tr className="border-b" key={member.email}>
<td className="px-4 py-2 text-sm">{member.name}</td>
<td className="px-4 py-2 text-muted-foreground text-sm">
{member.email}
</td>
<td className="px-4 py-2 text-sm">{member.role}</td>
<td className="px-4 py-2 text-sm">{member.department}</td>
<td className="px-4 py-2 text-sm">{member.location}</td>
<td className="px-4 py-2 text-sm">{member.status}</td>
</tr>
))}
</tbody>
</table>
</div>
<ScrollBar orientation="horizontal" />
</ScrollArea>FAQ
Why does this table scroll both ways?
ScrollArea is h-[400px] and max-w-md, and the table sits in a div with w-max. The fixed height scrolls the twenty rows. w-max lets the six columns run wider than the frame.
Which bar does this file add?
ScrollBar with orientation set to horizontal. The root already renders the vertical bar. Both are inside the same ScrollArea.
What are the columns?
Name, Email, Role, Department, Location, and Status. Each th and the cells use px-4 py-2 and text-start. Body cells that are secondary, such as the email, add text-sm text-muted-foreground.
How many people are in the table?
Twenty, from Array.from. Role cycles Admin, Editor, and Viewer. Department cycles Engineering, Design, Marketing, and Sales. Location is San Francisco or New York. Status is Active or Inactive.
API Reference
Scroll Area
Sets orientation="horizontal". The rest is on the Scroll Area page.






