# Path Input

Filesystem path input with tab autocomplete



<ComponentPreview base="opentui" name="path-input-demo" />

<Callout type="info">
  Path input requires Node.js filesystem access and may not render in the
  browser preview.
</Callout>

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/opentui-path-input
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="opentui" name="path-input" title="components/ui/path-input.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { PathInput } from "@/components/ui/path-input";
```

```tsx
<PathInput
  label="Project Directory"
  placeholder="/home/user/projects"
  onSubmit={(path) => console.log("Selected:", path)}
/>
```

API Reference [#api-reference]

PathInput [#pathinput]

| Prop          | Type                      | Default |
| ------------- | ------------------------- | ------- |
| `value`       | `string`                  | -       |
| `onChange`    | `(value: string) => void` | -       |
| `onSubmit`    | `(value: string) => void` | -       |
| `label`       | `string`                  | -       |
| `placeholder` | `string`                  | `"/"`   |
| `autoFocus`   | `boolean`                 | `false` |
| `id`          | `string`                  | -       |
| `width`       | `number`                  | `40`    |
| `filter`      | `string`                  | -       |
| `dirsOnly`    | `boolean`                 | `false` |
