473
Sponsor

Sidebar

Collapsible navigation sidebar panel

Terminal

Installation

$ pnpm dlx shadcn@latest add @termcn/sidebar

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

PropTypeDefault
itemsSidebarItem[]required
activeKeystring-
onSelect(key: string) => void-
collapsedbooleanfalse
widthnumber20
titlestring-

SidebarItem

PropTypeDefault
keystringrequired
labelstringrequired
iconstring-
badgestring | number-
childrenSidebarItem[]-