# Form Field

Form field wrapper with label, hint, and error



<ComponentPreview base="ink" name="form-field-demo" />

Installation [#installation]

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

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

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/form-field
    ```
  </TabsContent>

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

      <ComponentSource base="ink" name="form-field" title="components/ui/form-field.tsx" />

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

Usage [#usage]

```tsx
import { FormField } from "@/components/ui/form-field";
```

```tsx
<FormField label="Username" hint="Must be unique" required>
  <Text>my-input-here</Text>
</FormField>
```

API Reference [#api-reference]

FormField [#formfield]

| Prop         | Type        | Default    |
| ------------ | ----------- | ---------- |
| `label`      | `string`    | `required` |
| `children`   | `ReactNode` | `required` |
| `error`      | `string`    | -          |
| `hint`       | `string`    | -          |
| `required`   | `boolean`   | -          |
| `gap`        | `number`    | `0`        |
| `errorIcon`  | `string`    | `"✗"`      |
| `labelColor` | `string`    | -          |
