# Email Input

Email input with validation and domain suggestions



<ComponentPreview base="ink" name="email-input-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/email-input
    ```
  </TabsContent>

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

      <ComponentSource base="ink" name="email-input" title="components/ui/email-input.tsx" />

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

Usage [#usage]

```tsx
import { EmailInput } from "@/components/ui/email-input";
```

```tsx
<EmailInput
  label="Email"
  placeholder="you@example.com"
  onSubmit={(value) => console.log("Submitted:", value)}
/>
```

API Reference [#api-reference]

EmailInput [#emailinput]

| Prop          | Type                      | Default                                                    |
| ------------- | ------------------------- | ---------------------------------------------------------- |
| `value`       | `string`                  | -                                                          |
| `onChange`    | `(value: string) => void` | -                                                          |
| `onSubmit`    | `(value: string) => void` | -                                                          |
| `label`       | `string`                  | -                                                          |
| `placeholder` | `string`                  | `"you@example.com"`                                        |
| `autoFocus`   | `boolean`                 | `false`                                                    |
| `id`          | `string`                  | -                                                          |
| `width`       | `number`                  | `40`                                                       |
| `suggestions` | `string[]`                | `["gmail.com", "yahoo.com", "hotmail.com", "outlook.com"]` |
