Themes
- Default
- Catppuccin
- Dracula
- High Contrast
- High Contrast Light
- Monokai
- Nord
- One Dark
- Solarized
- Tokyo Night
- AMOLED
- Aura
- Ayu
- Carbonfox
- Catppuccin Frappe
- Catppuccin Macchiato
- Cobalt2
- Cursor
- Everforest
- Flexoki
- GitHub
- Gruvbox
- Kanagawa
- Lucent Orng
- Material
- Matrix
- Mercury
- Night Owl
- OC-2
- One Dark Pro
- OpenCode
- Orng
- Osaka Jade
- Palenight
- Rose Pine
- Shades of Purple
- Synthwave '84
- Vercel
- Vesper
- Zenburn
Utility
AI
Terminal
tree-demo
No opentui live preview is registered for this example yet.
Installation
$ pnpm dlx shadcn@latest add @termcn/tree
Usage
import { Tree } from "@/components/ui/tree";<Tree
defaultExpanded={["src"]}
nodes={[
{
key: "src",
label: "src",
children: [
{ key: "index", label: "index.ts" },
{ key: "utils", label: "utils.ts" },
],
},
{ key: "pkg", label: "package.json" },
]}
/>API Reference
Tree
| Prop | Type | Default |
|---|---|---|
nodes | TreeNode[] | required |
onSelect | (node: TreeNode) => void | - |
defaultExpanded | string[] | [] |
expandedIcon | string | "▼" |
collapsedIcon | string | "▶" |
leafIcon | string | "•" |
TreeNode
| Prop | Type | Default |
|---|---|---|
key | string | required |
label | string | required |
children | TreeNode[] | - |
icon | string | - |