Utility
Terminal
█
sidebar-demo █
Loading preview... █
█
█
█
█
█
█
█
█
█
█
█
█
█
█
█Installation
$ pnpm dlx shadcn@latest add @termcn/opentui/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
Sidebar
| Prop | Type | Default |
|---|---|---|
items | SidebarItem[] | required |
activeKey | string | - |
onSelect | (key: string) => void | - |
collapsed | boolean | false |
width | number | 20 |
title | string | - |
SidebarItem
| Prop | Type | Default |
|---|---|---|
key | string | required |
label | string | required |
icon | string | - |
badge | string | number | - |
children | SidebarItem[] | - |