5Sponsor

Directory Tree

Filesystem browser with expand/collapse

Terminal
directory-tree-demo
No opentui live preview is registered for this example yet.

Installation

pnpm dlx shadcn@latest add @termcn/directory-tree

Usage

import { DirectoryTree } from "@/components/ui/directory-tree";
<DirectoryTree
  rootPath="/home/user/project"
  maxDepth={3}
  label="Project Files"
/>

API Reference

DirectoryTree

PropTypeDefault
rootPathstringprocess.cwd()
onSelect(path: string) => voidundefined
maxDepthnumber2
showHiddenbooleanfalse
labelstringundefined