Utility
Terminal
File picker requires Node.js filesystem access and may not render in the browser preview.
Installation
$ pnpm dlx shadcn@latest add @termcn/ink/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
| Prop | Type | Default |
|---|---|---|
value | string | - |
onChange | (path: string) => void | - |
onSubmit | (path: string) => void | - |
label | string | - |
startDir | string | process.cwd() |
extensions | string[] | - |
dirsOnly | boolean | false |
autoFocus | boolean | false |
id | string | - |
width | number | 50 |
maxVisible | number | 8 |
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: Ink labels and semantic state expose the component without relying on visual styling alone.