Utility
AI
Terminal
Installation
pnpm dlx shadcn@latest add https://termcn.dev/r/sidebar.json
Usage
import { Sidebar } from "@/components/ui/sidebar";<Sidebar
title="Explorer"
activeKey="inbox"
items={[
{ key: "inbox", label: "Inbox", icon: "📥", badge: 3 },
{ key: "drafts", label: "Drafts", icon: "📝" },
]}
onSelect={(key) => console.log(key)}
/>API Reference
Sidebar
| Prop | Type | Default |
|---|---|---|
items | SidebarItem[] | required |
activeKey | string | undefined |
onSelect | (key: string) => void | undefined |
collapsed | boolean | false |
width | number | 20 |
title | string | undefined |
SidebarItem
| Prop | Type | Default |
|---|---|---|
key | string | required |
label | string | required |
icon | string | undefined |
badge | string | number | undefined |
children | SidebarItem[] | undefined |