# Email input

A labeled email field with validation and help text.

Access: free. Category: Forms. Kind: primitive.

## When to use

- Use it when a product interface needs a labeled email field with validation and help text.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose input-group instead when prefixes, suffixes, units and actions for a labelled native input is the actual interface need, rather than email input.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Email input

```sh
npx shadcn@latest add https://tidalui.com/r/form-field.json
```

Stylesheets: `components/ui/tidal.css`, `components/ui/form-field.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/form-field.css";
import{TidalField}from"./components/ui/form-field";
export default()=><div className="tidal-scope"><TidalField label={"Demo"}/></div>;
```

## Structured props

- `TidalField.label: string`: Required label value accepted by this exported component.
- `TidalField.description?: string | undefined`: Optional description value accepted by this exported component.
- `TidalField.error?: string | undefined`: Optional error value accepted by this exported component.
- `TidalField.leading?: ReactNode`: Optional leading value accepted by this exported component.
- `TidalField.rootClassName?: string | undefined` (default ""): Optional root class name value accepted by this exported component.
- `TidalField.trailing?: ReactNode`: Optional trailing value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/form-field.tsx) | [Manifest](https://tidalui.com/examples/form-field.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useState, useRef } from "react";

import { ArrowUpRight, Check, Mail } from "lucide-react";

import { TidalField } from "./components/ui/form-field";

import "./components/ui/form-field.css";

import { TidalButton } from "./components/ui/tidal-button";



const tidalExampleStyles = ".field-specimen{padding:24px;background:var(--t-surface);border:1px solid var(--t-border);border-radius:var(--t-radius-card);box-shadow:0 10px 20px -12px #00000026,0 1px 2px #00000008;width:100%;max-width:330px}.field-specimen>.demo-eyebrow{display:block;font-size:11px;margin-bottom:10px}.field-specimen>h3{font-size:22px;letter-spacing:-.8px;color:var(--t-ink);margin-bottom:24px}.field-specimen>.tidal-button{margin-top:20px;width:100%;font-size:11px}";

export function FieldDemo() {
  const [email, setEmail] = useState("");
  const [error, setError] = useState("");
  const [done, setDone] = useState(false);
  const field = useRef<HTMLInputElement>(null);
  return (
    <form
      className="field-specimen"
      noValidate
      onSubmit={(e) => {
        e.preventDefault();
        if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
          setError("Enter a valid work email.");
          setDone(false);
          field.current?.focus({ preventScroll: true });
        } else {
          setError("");
          setDone(true);
        }
      }}
    >
      <TidalField
        ref={field}
        required
        label="Work email"
        type="email"
        autoComplete="email"
        value={email}
        onChange={(e) => {
          setEmail(e.target.value);
          setError("");
          setDone(false);
        }}
        placeholder="you@company.com"
        description="Just a demo. Nothing leaves this page."
        error={error}
        leading={<Mail size={15} />}
      />
      <TidalButton type="submit">
        {done ? <Check size={15} /> : null}
        {done ? "You’re all set" : "Continue"}{" "}
        {!done ? <ArrowUpRight size={15} /> : null}
      </TidalButton>
    </form>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <FieldDemo />
    </div>
  );
}

```

## Gotchas

- Keep field state, validation results, submission, and persistence in the host form workflow.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Native input props, ref and required supported. label required; description, error, decorative leading, trailing, rootClassName optional. className targets the native input. Help/error IDs compose with aria-describedby; error sets aria-invalid and announces via role=alert.
