5Sponsor

File Picker

Interactive file browser and picker

Terminal
file-picker-demo
No opentui live preview is registered for this example yet.

Installation

pnpm dlx shadcn@latest add @termcn/file-picker

Usage

import { FilePicker } from "@/components/ui/file-picker";
<FilePicker
  label="Select a config file"
  extensions={[".json", ".yaml", ".yml"]}
  onSubmit={(path) => console.log("Selected:", path)}
/>

API Reference

FilePicker

PropTypeDefault
valuestringundefined
onChange(path: string) => voidundefined
onSubmit(path: string) => voidundefined
labelstringundefined
startDirstringprocess.cwd()
extensionsstring[]undefined
dirsOnlybooleanfalse
autoFocusbooleanfalse
idstringundefined
widthnumber50
maxVisiblenumber8