Utility
Terminal
Installation
$ pnpm dlx shadcn@latest add @termcn/ink/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[] | - |
Notes
Accessibility
termcn exposes the following behavior through Ink's terminal accessibility APIs. This is not a browser ARIA or general WCAG-conformance claim.
- Keyboard: Arrow keys move inside the composite;
Home/Endselect the first or last enabled item;Enter/Spaceactivate, select, or toggle;Escapecancels or closes an owned surface;Tab/Shift+Tabmove between termcn/Ink focus targets. - Focus and composition: Input is active only while the component's focus target is focused, enabled, active, and inside the topmost focus scope.
- Screen reader: Screen-reader mode removes decorative output while preserving meaningful labels and state.