<!-- generated by scripts/gen-docs.mjs from docs/system/input.md. Edit the source and rerun. -->
# Input

## Description
Takes one line of typed text, such as a name, an address or a search term.

`import { Input } from "@/components/cobalt/ui/input"`, source `registry/cobalt/ui/input.tsx`, status `ready-with-gaps`.
`import { InputGroup, InputGroupInput, InputGroupAddon, InputGroupButton } from "@/components/cobalt/ui/input-group"`, source `registry/cobalt/ui/input-group.tsx`, status `ready-with-gaps`.
Foundation: `shadcn input (base-luma, base)`, with InputGroup as Base UI Input inside a team-built box. Traps checked: `trap/field-label`, `trap/label-unbound`, `trap/field-input-type`, `trap/field-affix-focus`, `trap/field-form-enter`, `trap/field-error-link`, `trap/field-error-timing`, `trap/field-keeps-input`, `trap/touch-input-zoom`, `trap/touch-autofocus`, `trap/control-height`, `trap/focus-ring-shape`, `trap/hover-beats-focus`, `trap/disabled-still-hovers`, `trap/required-everywhere`, `trap/button-type`, `trap/button-icon-name`, `trap/icon-optical-size`.

Where each trap is answered: `trap/field-label` and `trap/label-unbound` in `rule/input-has-a-label` and `rule/input-group-search-is-named`; `trap/field-input-type` in `rule/input-type-for-the-keyboard`; `trap/field-affix-focus` in `rule/input-affix-inside-the-box`, a press on the glyph, a text addon or the padding puts the caret in the input (measured, `.design-system/evidence/input-group/measure.json`); `trap/field-form-enter` in `rule/input-in-a-form`; `trap/field-error-link` in `rule/input-error-is-linked`; `trap/field-error-timing` in Field's `rule/field-error-when-settled`; `trap/field-keeps-input` in `rule/input-keeps-the-value-on-failure`; `trap/touch-input-zoom` in States, 16px text at 390px measured; `trap/touch-autofocus` in `rule/input-no-autofocus-on-a-page`; `trap/control-height` in Tokens, 36px beside a 36px button measured; `trap/required-everywhere` in Field's `rule/label-marks-the-rarer`; `trap/button-type` in Props, `InputGroupButton` defaults to `type="button"`; `trap/button-icon-name` in `rule/input-group-button-is-named`; `trap/icon-optical-size`, the glyph is 16px beside 14px text. Not applicable: `trap/focus-ring-shape`, focus is a box-shadow on the box itself, the group's box when there is one, so the edge and ring follow its rounded corners (D40), and a button inside draws its outline 4px within the box, so nothing clips it; `trap/hover-beats-focus`, hover changes nothing on the box, so it cannot beat focus (D40); `trap/disabled-still-hovers`, a disabled field takes no pointer events.

### Foundation
| Given by the foundation | Added by the team |
|---|---|
| Base UI `Input`: a native `<input>` that joins a Base UI `Field` or `Form` when one wraps it, and otherwise passes every attribute through to the element | The filled look, `bg-input/50` with a transparent border, the same at rest, under the pointer and while focused; after you reach the field with the Tab key, focus draws the `field-focus` utility from `registry/cobalt/styles.css`, an inset 1px edge in `--primary` and a 3px ring of `--primary` at 20 percent outside it, and on an invalid field the same edge and ring in `--destructive`; a click into the field shows only the caret, because `registry/cobalt/lib/focus-source.ts` (`trackFocusSource`, started from an effect in the component, so it is a client component) sets `data-focus-source` on the root element to `keyboard` on a Tab key press and to `pointer` on a pointer press, and the utility draws only under `:root[data-focus-source="keyboard"]` (D40, which replaces the earlier "no ring, darker fill" text of person D11 and audit Fix now 6); the height from `--control` as `min-h` so text zoom grows the box (D20); `text-base` below `md` and `text-sm` from `md` up, so a phone does not zoom on focus; the invalid wash `aria-invalid:bg-destructive/10` in place of a red border; the edge and ring ease in on `transition-shadow duration-press`, `--t-press`; `quietAutofill(type, autoComplete)` from `registry/cobalt/lib/autofill.ts`, spread before the host's props, which leaves password managers to fill every field and adds `data-1p-ignore`, `data-op-ignore`, `data-bwignore`, `data-lpignore` and `data-form-type="other"` only when `type` is `search` or `autoComplete` is `off`; whatever a password manager inserts beside a field is taken out of the layout by a rule in `registry/cobalt/base.css`, so the field and what sits around it keep their size (D37) `text-ellipsis`, so a value or placeholder cut by the box ends in an ellipsis while the field is not focused; `unicode-bidi: plaintext`, so an address or a name reads in its own direction on a right-to-left page instead of moving its `@` to the front (`docs/research/2026-10-16-break-ui-inputs.md`). |
| InputGroup: Base UI `Input`, a native `<input>` that joins a Base UI `Field` when there is one | The field's box drawn on a wrapper (`fieldBoxClasses`, exported for the combobox and the palette) with Input's fill, corner and height, 12px padding at each end and 8px between parts; the Tab ring drawn on the box when the input inside has focus, nothing for a click (D40); the invalid wash and red ring when the input carries `aria-invalid`; half opacity when it is disabled; a press anywhere on the box that is not a button focuses the input; `InputGroupAddon` with `align`, at most half the box, a text addon cut with an ellipsis; `InputGroupButton`, 28px with a 6px corner, stepped out to 4px from the box's edge so its corner is concentric; password managers kept out of a search input (`quietAutofill`) |

## Examples
A field named by its label, with an example in the placeholder.

Real uses, 0 call sites (`rg -n "<Input\b" app docs/system/examples --glob '!docs/system/examples/input/*'`): the showcase chrome renders no Input of its own, the examples folder does not count, and the registry folder never counts.

Uses inside the examples folder, which stand in for product screens until the first one lands on the system:
- The name field of the popover example, inside a `Field`, `docs/system/examples/popover/default.tsx:73`.
- The email field of the invite dialog, `type="email"` inside a `Field`, `docs/system/examples/dialog/default.tsx:97-99`.
- An email field inside a `Field`, described and checked when it loses focus, `docs/system/examples/field/default.tsx:16`.
- An InputGroup holding a command with a CopyButton at its end, `docs/system/examples/copy-button/in-field.tsx:12-16`.
- The fields inside a `Grow` surface, the source address in `docs/system/examples/grow/default.tsx:50-51` and the view name in `docs/system/examples/grow/floating.tsx:34-35`, have no room for a visible Label and carry an `aria-label` of their own ("Source address", "View name"), the one shape `rule/input-has-a-label` allows without one.
- The screener scene still hand-rolls its search field with an icon over it and `pl-9`, `docs/system/examples/blocks/screener.tsx:942`, allowlisted in `scripts/check-allowlist.json`; the combobox and the command palette reuse the group's box classes, and the emoji picker's search is an InputGroup, `registry/cobalt/ui/emoji-picker.tsx:360`.

### Example files
| File | Covers | Caption |
|---|---|---|
| `docs/system/examples/input/default.tsx` | default | A field named by its label, with an example in the placeholder |
| Not applicable: the browser's default, the field of default.tsx | type=text | A plain text field |
| `docs/system/examples/input/type-email.tsx` | type=email | An address brings the keyboard with the @ sign and the browser's address check |
| `docs/system/examples/input/type-tel.tsx` | type=tel | A phone number brings the dial pad |
| `docs/system/examples/input/type-url.tsx` | type=url | A web address brings the keyboard with the slash and the dot |
| Not applicable: a day, a birth date included, is a DatePicker with `typed`, which takes it typed in the locale's order or picked, where a native date field draws the browser's own parts in the box | type=date | The DatePicker page's typed example |
| `docs/system/examples/input/type-password.tsx` | type=password | The autocomplete token tells the password manager what goes here, and the eye at the end shows the password while it is on |
| `docs/system/examples/input/type-search.tsx` | type=search | A large search field named by aria-label, with no visible label |
| Not applicable: a file comes through FileDrop, which takes a drag too and shows each upload, where a native file field draws the browser's own button in the box | type=file | The FileDrop page |
| `docs/system/examples/input/align-start.tsx` | align=start | The start of the address every listing shares sits before the text, inside the box |
| `docs/system/examples/input/with-addons.tsx` | align=end | A search field with its glyph inside the box and a Clear button once there is text |
| Not applicable: the field of default.tsx is empty with a placeholder | state:empty | The placeholder in the muted ink |
| Not applicable: type into any example | state:filled | The value in the ink |
| `docs/system/examples/input/state-invalid.tsx` | state:invalid | After a check, the red wash on the box and the error under it |
| `docs/system/examples/input/state-disabled.tsx` | state:disabled | The value stays at half opacity and takes no input |
| `docs/system/examples/input/state-read-only.tsx` | state:read-only | Focusable and copyable at full opacity, but not editable |
| Not applicable: hover is reached with the pointer on any example | state:hover | Nothing changes on the box (D40) |
| Not applicable: focus is reached with a click or Tab on any example | state:focus | The caret after a click; the accent edge and ring too after Tab (D40) |
| `docs/system/examples/input/on-submit.tsx` | composition:Form | Save checks both fields, puts each error under its field and moves focus to the first |
| `docs/system/examples/input/in-field.tsx` | composition:Field | Its label, description and error are wired to the input |

Example: A field named by its label, with an example in the placeholder (`docs/system/examples/input/default.tsx`)

```tsx
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Input } from "@/components/cobalt/ui/input";

export default function Example() {
  return (
    <Field className="max-w-sm">
      <FieldLabel>Full name</FieldLabel>
      <Input autoComplete="name" placeholder="Ana Lima" />
    </Field>
  );
}
```

Example: Save checks both fields, puts each error under its field and moves focus to the first (`docs/system/examples/input/on-submit.tsx`)

```tsx
import { useRef, useState, type ChangeEvent } from "react";

import { Field, FieldError, FieldLabel } from "@/components/cobalt/ui/field";
import { Input } from "@/components/cobalt/ui/input";
import { StateButton } from "@/components/cobalt/ui/state-button";
import { useAction } from "@/lib/cobalt/use-action";

// Stands in for your API call. It answers after 900ms, and fails while the browser is offline or the
// address has ?network=offline.
const request = () =>
  new Promise<void>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Error("offline"));
      else resolve();
    }, 900),
  );

type Values = { venue: string; website: string };
type Key = keyof Values;

function problems(values: Values): Values {
  let website = "";
  try {
    if (!/^https?:$/.test(new URL(values.website.trim()).protocol)) throw new Error("scheme");
  } catch {
    website = "Enter an address such as https://example.com.";
  }
  return { venue: values.venue.trim() === "" ? "Enter the venue's name as guests know it." : "", website };
}

export default function Example() {
  const [values, setValues] = useState<Values>({ venue: "", website: "" });
  // Errors appear on Save or when a checked field loses focus, and leave as soon as the value is right.
  const [errors, setErrors] = useState<Values>({ venue: "", website: "" });
  const [checked, setChecked] = useState(false);
  const inputs = { venue: useRef<HTMLInputElement>(null), website: useRef<HTMLInputElement>(null) };
  const save = useAction(request);
  const edit = (key: Key) => (event: ChangeEvent<HTMLInputElement>) => {
    const next = { ...values, [key]: event.target.value };
    setValues(next);
    if (problems(next)[key] === "") setErrors((was) => ({ ...was, [key]: "" }));
  };
  const leave = (key: Key) => () => {
    if (checked) setErrors((was) => ({ ...was, [key]: problems(values)[key] }));
  };
  return (
    <form
      noValidate
      className="flex max-w-sm flex-col gap-3"
      onSubmit={(event) => {
        event.preventDefault();
        const found = problems(values);
        setErrors(found);
        setChecked(true);
        const first = (["venue", "website"] as const).find((key) => found[key] !== "");
        if (first) {
          inputs[first].current?.focus();
          return;
        }
        void save.run();
      }}
    >
      <Field>
        <FieldLabel>Venue name</FieldLabel>
        <Input
          ref={inputs.venue}
          autoComplete="organization"
          value={values.venue}
          onChange={edit("venue")}
          onBlur={leave("venue")}
        />
        <FieldError reserve>{errors.venue}</FieldError>
      </Field>
      <Field>
        <FieldLabel>Website</FieldLabel>
        <Input
          ref={inputs.website}
          type="url"
          autoComplete="url"
          placeholder="https://example.com"
          value={values.website}
          onChange={edit("website")}
          onBlur={leave("website")}
        />
        <FieldError reserve>{errors.website}</FieldError>
      </Field>
      <div className="flex flex-col items-start gap-2">
        <StateButton
          type="submit"
          status={save.status}
          pendingLabel="Saving"
          successLabel="Saved"
          failureLabel="Not saved"
        >
          Save venue
        </StateButton>
        {/* The line is always there, so the failure moves nothing when it appears. */}
        <p role="status" className="min-h-5 text-sm text-destructive">
          {save.error !== null ? "The venue was not saved. Check your connection and try again." : ""}
        </p>
      </div>
    </form>
  );
}
```

Example: Its label, description and error are wired to the input (`docs/system/examples/input/in-field.tsx`)

```tsx
import { Field, FieldDescription, FieldLabel } from "@/components/cobalt/ui/field";
import { Input } from "@/components/cobalt/ui/input";

export default function Example() {
  return (
    <Field className="max-w-sm">
      <FieldLabel>Display name</FieldLabel>
      <Input placeholder="How others see you" autoComplete="nickname" />
      <FieldDescription>Shown beside everything you post.</FieldDescription>
    </Field>
  );
}
```

## Variants
Input has no variant axis of its own: the native `type` picks the keyboard and the browser's checks (Props and `rule/input-type-for-the-keyboard`), and the height is one token, `--control`, with `--control-lg` for a search bar through `className`. The one axis is where an addon sits in an InputGroup.

### align
- `start`: before the text, for a glyph or a fixed prefix such as a site address.
- `end`: after the text, for a button that acts on it, such as Clear, Show or Copy.

Example: An address brings the keyboard with the @ sign and the browser's address check (`docs/system/examples/input/type-email.tsx`)

```tsx
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Input } from "@/components/cobalt/ui/input";

export default function Example() {
  return (
    <Field className="max-w-sm">
      <FieldLabel>Email</FieldLabel>
      <Input type="email" autoComplete="email" placeholder="ana.lima@example.com" />
    </Field>
  );
}
```

Example: A phone number brings the dial pad (`docs/system/examples/input/type-tel.tsx`)

```tsx
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Input } from "@/components/cobalt/ui/input";

export default function Example() {
  return (
    <Field className="max-w-sm">
      <FieldLabel>Phone</FieldLabel>
      <Input type="tel" autoComplete="tel" placeholder="+44 20 7946 0000" />
    </Field>
  );
}
```

Example: A web address brings the keyboard with the slash and the dot (`docs/system/examples/input/type-url.tsx`)

```tsx
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Input } from "@/components/cobalt/ui/input";

export default function Example() {
  return (
    <Field className="max-w-sm">
      <FieldLabel>Website</FieldLabel>
      <Input type="url" autoComplete="url" placeholder="https://example.com" />
    </Field>
  );
}
```

Example: The autocomplete token tells the password manager what goes here, and the eye at the end shows the password while it is on (`docs/system/examples/input/type-password.tsx`)

```tsx
import { useState } from "react";

import { EyeIcon, EyeOffIcon } from "@/components/cobalt/icon";
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { IconButton } from "@/components/cobalt/ui/icon-button";
import { IconSwap } from "@/components/cobalt/ui/icon-swap";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/cobalt/ui/input-group";

export default function Example() {
  const [shown, setShown] = useState(false);
  return (
    <Field className="max-w-sm">
      <FieldLabel>Password</FieldLabel>
      <InputGroup>
        <InputGroupInput type={shown ? "text" : "password"} autoComplete="current-password" />
        <InputGroupAddon align="end">
          {/* One name, with its state in aria-pressed, so a screen reader hears "Show password, pressed". */}
          <IconButton
            size="icon-xs"
            label="Show password"
            aria-pressed={shown}
            onClick={() => setShown((was) => !was)}
            icon={<IconSwap show={shown ? "second" : "first"} first={<EyeIcon />} second={<EyeOffIcon />} />}
          />
        </InputGroupAddon>
      </InputGroup>
    </Field>
  );
}
```

Example: A large search field named by aria-label, with no visible label (`docs/system/examples/input/type-search.tsx`)

```tsx
import { useState } from "react";

import { Input } from "@/components/cobalt/ui/input";

const members = ["Mara Okafor", "Jonas Lindqvist", "Priya Raman", "Tomás Herrera", "Yuki Matsuda"];

export default function Example() {
  const [query, setQuery] = useState("");
  // The members are already loaded, so the list narrows as you type.
  const shown = members.filter((name) => name.toLowerCase().includes(query.trim().toLowerCase()));
  return (
    <form
      role="search"
      className="flex w-full max-w-sm flex-col gap-3"
      onSubmit={(event) => event.preventDefault()}
    >
      <Input
        type="search"
        aria-label="Search members"
        placeholder="Search members"
        className="min-h-(--control-lg)"
        value={query}
        onChange={(event) => setQuery(event.target.value)}
      />
      <ul className="flex flex-col gap-2 text-sm">
        {shown.map((name) => (
          <li key={name}>{name}</li>
        ))}
        {shown.length === 0 && <li className="text-muted-foreground">No member matches “{query.trim()}”.</li>}
      </ul>
    </form>
  );
}
```

Example: The start of the address every listing shares sits before the text, inside the box (`docs/system/examples/input/align-start.tsx`)

```tsx
import { Field, FieldDescription, FieldLabel } from "@/components/cobalt/ui/field";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/cobalt/ui/input-group";

export default function Example() {
  return (
    <Field className="w-full max-w-sm">
      <FieldLabel>Listing address</FieldLabel>
      <InputGroup>
        <InputGroupAddon>stays.example/</InputGroupAddon>
        <InputGroupInput placeholder="harbour-loft" autoComplete="off" />
      </InputGroup>
      <FieldDescription>Use letters, numbers and hyphens.</FieldDescription>
    </Field>
  );
}
```

Example: A search field with its glyph inside the box and a Clear button once there is text (`docs/system/examples/input/with-addons.tsx`)

```tsx
import { useState } from "react";

import { SearchIcon, XIcon } from "@/components/cobalt/icon";
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/cobalt/ui/input-group";

export default function Example() {
  const [query, setQuery] = useState("");
  return (
    <InputGroup className="w-full max-w-sm">
      <InputGroupAddon>
        <SearchIcon aria-hidden="true" />
      </InputGroupAddon>
      <InputGroupInput
        type="search"
        aria-label="Search filings"
        placeholder="Search filings"
        value={query}
        onChange={(event) => setQuery(event.target.value)}
      />
      {query !== "" && (
        <InputGroupAddon align="end">
          <InputGroupButton aria-label="Clear search" onClick={() => setQuery("")}>
            <XIcon aria-hidden="true" />
          </InputGroupButton>
        </InputGroupAddon>
      )}
    </InputGroup>
  );
}
```

## States
| State | Trigger | What the user can do | Shown by, besides color | Checked by |
|---|---|---|---|---|
| empty | no value | type, paste, focus | the placeholder text | screenshot |
| filled | a value | edit, select, copy | the value in the ink | screenshot |
| hover | pointer over, under `(hover: hover)` | click to focus | nothing changes on the box; the fill stays `--input` at 50 percent (D40) | by hand |
| focus | Tab, a click, or a click on the label | type | the caret; after Tab also the `--primary` edge and ring, and a click shows no ring; the fill does not change (D40) | by hand |
| invalid | `aria-invalid` from the host, or from `Field` when a `FieldError` renders | fix the value | the error text tied by `aria-describedby`, read after the name | test |
| disabled | `disabled` | nothing; the field leaves the tab order and takes no pointer | half opacity | test |
| read-only | `readOnly` | focus, select and copy, not edit | full opacity and the caret; typing changes nothing | test |

In an InputGroup every state shows on the whole box: the Tab ring, the invalid wash and half opacity draw on the box, the glyph and the text alike (measured, `.design-system/evidence/input-group/measure.json`). Pending is not a state of the field: the form's submit button carries it through `StateButton` (`rule/button-keeps-its-box-when-busy`), and the field stays editable until the request settles. The text is 16px at 390px (measured, .design-system/evidence/input/grow-placeholder-390.json), so a phone does not zoom on focus (`trap/touch-input-zoom`).

Example: After a check, the red wash on the box and the error under it (`docs/system/examples/input/state-invalid.tsx`)

```tsx
import { useState } from "react";

import { Field, FieldError, FieldLabel } from "@/components/cobalt/ui/field";
import { Input } from "@/components/cobalt/ui/input";

// A country code, then at least six more digits.
const valid = (phone: string) => /^\+\d[\d ]{6,}$/.test(phone.trim());

export default function Example() {
  // As after a submit with this number; the error leaves as soon as the number has its country code.
  const [phone, setPhone] = useState("7946 0000");
  const [error, setError] = useState(true);
  return (
    <Field className="max-w-sm">
      <FieldLabel>Phone</FieldLabel>
      <Input
        type="tel"
        autoComplete="tel"
        value={phone}
        onChange={(event) => {
          setPhone(event.target.value);
          if (valid(event.target.value)) setError(false);
        }}
        onBlur={() => setError(!valid(phone))}
      />
      <FieldError reserve>{error ? "Start with the country code, such as +44\u00a020\u00a07946\u00a00000." : ""}</FieldError>
    </Field>
  );
}
```

Example: The value stays at half opacity and takes no input (`docs/system/examples/input/state-disabled.tsx`)

```tsx
import { Field, FieldLabel } from "@/components/cobalt/ui/field";
import { Input } from "@/components/cobalt/ui/input";

export default function Example() {
  return (
    <Field disabled className="max-w-sm">
      <FieldLabel>Workspace</FieldLabel>
      <Input defaultValue="Oslo office" />
    </Field>
  );
}
```

Example: Focusable and copyable at full opacity, but not editable (`docs/system/examples/input/state-read-only.tsx`)

```tsx
import { Field, FieldDescription, FieldLabel } from "@/components/cobalt/ui/field";
import { Input } from "@/components/cobalt/ui/input";

export default function Example() {
  return (
    <Field className="max-w-sm">
      <FieldLabel>Account email</FieldLabel>
      <Input type="email" readOnly defaultValue="ana.lima@example.com" />
      <FieldDescription>Your workspace owner can change it.</FieldDescription>
    </Field>
  );
}
```

### State precedence
- Disabled and invalid: disabled wins. The wash fades with the box to half opacity, and the host drops the error text while the field is disabled, so no error reads on a field you cannot fix.
- Disabled and focus: disabled wins. A disabled input leaves the tab order, so it never holds focus.
- Disabled and hover: disabled wins. Pointer events are off, so nothing changes under the pointer.
- Read-only and invalid: both show. The value stays selectable and the wash marks it, for a value you fix elsewhere.
- Read-only and focus: both show. The caret sits in the text and typing changes nothing.
- Invalid and focus: both show. The wash stays while you type the fix, with the red edge and ring after Tab and only the caret after a click, and the wash leaves when the host clears `aria-invalid` (D40).
- Focus and hover: focus wins, and hover adds nothing. The box does not change under the pointer, so the caret, and the edge and ring after Tab, read the same with or without it (D40).
- Empty and filled: Not applicable: a field is one or the other.

### Motion
| Trigger | Kind | Preset | Properties | Reduced motion |
|---|---|---|---|---|
| focus in and out | announce | `--t-press` on `--curve` | box-shadow, after Tab only; a click shows no ring to animate | the same; the edge and ring still ease in |
| valid to invalid and back, and the fade to disabled | announce | none; the wash and the opacity change in the same frame | none | the same |
| pointer over or pressing an `InputGroupButton` | input | `pressable`, `--t-press` | background-color, box-shadow | the colour change stays |

## Props

<!-- Props generated from registry/cobalt/ui/input.tsx, registry/cobalt/ui/input-group.tsx with TypeScript by scripts/props-table.mjs -->
### Input

No props of its own.

Also accepts every native `<input>` attribute.

### InputGroup

No props of its own.

Also accepts every native `<div>` attribute.

### InputGroupAddon

| Prop | Type | Default | Purpose |
|---|---|---|---|
| `align?` | `"start" \| "end"` | `"start"` | Which end of the box it sits at, in reading order: `start` before the text, `end` after it. |

Also accepts every native `<div>` attribute.

### InputGroupButton

No props of its own.

Also accepts every native `<button>` attribute.

### InputGroupInput

No props of its own.

Also accepts every native `<input>` attribute.

Every native input attribute passes through: `type` (the browser's `text` when unset), `disabled`, `readOnly`, `required`, `pattern`, `inputMode`, `autoComplete`, `placeholder`, `name`, `aria-*`. `ref` reaches the `<input>`. `className` is merged last and is for placement, such as `w-full`, or `min-h-(--control-lg)` on a search bar. There is no size prop: every field is `--control` tall. Password managers are left to fill every field. Only `type="search"` and `autoComplete="off"` carry the attributes that tell them to stay out; 1Password documents `data-1p-ignore` and `data-op-ignore`, Bitwarden honours `data-bwignore`, and LastPass and Dashlane read `data-lpignore` and `data-form-type`, which their vendors do not document. Anything a password manager inserts beside a field is taken out of the layout by `registry/cobalt/base.css`.

In an InputGroup, `InputGroupInput` takes the same native attributes, and the `id`, which a surrounding `Field` sets on its own. `align` on `InputGroupAddon` is `start` (the default) or `end`, in reading order, so it flips in right-to-left text. `InputGroupButton`'s `type` defaults to `button`, so a button inside a form never submits it. A `className` on `InputGroup` sizes the box, such as `w-full max-w-sm`.

## Usage

### When to use
- You type one line: a name, an address, a code, a search term.
- The value is free text the system cannot list as options.
- Something belongs inside the box: a search glyph, a fixed prefix such as a site address, or one action on the text such as Clear or Show. Use an InputGroup.

### When not to use
- The text runs past one line, such as notes or an agenda. Use Textarea instead.
- The value is one of up to 10 known options. Use Select instead; 2 to 4 options that fit in a row use SegmentedControl instead.
- The text picks from a long list of values. Use Combobox instead.
- The value is a count or an amount with a unit, such as nights or a price. Use NumberField instead, whose `format` writes the unit.
- The value is a day. Use DatePicker instead, with `typed` for a birth date or a day years away.
- The value is a file. Use FileDrop instead.
- The field needs a description or an error. Use Field instead, which holds the Input and wires both to it.

### Rules
- `rule/input-has-a-label`: When an Input or an `InputGroupInput` renders, put it inside a `Field` with a `FieldLabel`, which names it with no id written, or give it `aria-label` where the layout has no room for words (a search bar), instead of leaving the placeholder as the only name, because a placeholder leaves on the first keystroke and a screen reader never reads it as the name. Evidence: person D34; principle wcag: 3.3.2 Labels or instructions, every input has a visible label or a name; app 24/25 Inputs rendered on the component pages had a name, measured with Playwright on 2026-10-17 (a `label`, `aria-label` or `aria-labelledby`), the Grow fields named by `aria-label` (`docs/system/examples/grow/default.tsx:51`), and the one stray, a bare disabled Input on this page, put in a Field the same day. Check: lint trap/label-unbound (scripts/check-system.mjs); test `field.test.tsx` "a bare control is named by the label, with no FieldControl around it".
  - Don't: `<Input placeholder="Email" />`
  - Do: `<Field><FieldLabel>Email</FieldLabel><Input type="email" /></Field>`
- `rule/input-type-for-the-keyboard`: When the value is an address, a phone number, a URL, a password or a digit code, set `type="email"`, `type="tel"`, `type="url"`, `type="password"` or `inputMode="numeric"`, with the matching `autoComplete` token (`email`, `tel`, `current-password`, `one-time-code`), instead of the default text type, because the phone keyboard, the password manager and the browser's checks read `type`, and a code left as text gets a spellcheck underline. Evidence: app 7/7 address fields in the examples pass `type="email"` (`docs/system/examples/dialog/default.tsx:99`, `docs/system/examples/field/default.tsx:17`, `docs/system/examples/input/type-email.tsx:9`), and the phone, web address and birth date tiles pass `tel`, `url` and `date`; principle platform: HTML input types and autocomplete tokens pick the keyboard and the autofill. Check: test `input.test.tsx` "the phone keyboard hints pass through"; review of every new field's `type`.
  - Don't: `<Input placeholder="ada@example.com" />`
  - Do: `<Input type="email" autoComplete="email" />`
- `rule/input-error-is-linked`: When an Input is invalid, set `aria-invalid` on it and tie the error text to it with `aria-describedby`, or let `Field` set both, instead of the wash alone or an error paragraph beside it, because the wash is colour only and a screen reader hears the error only through the link. Evidence: person D34; principle wcag: 3.3.1 Error identification, the error is described to the user in text; app 5/5 invalid Inputs on the Field and Input pages link their error through Field (`docs/system/examples/field/state-invalid.tsx:16`, `docs/system/examples/input/state-invalid.tsx:17`, `docs/system/examples/input/on-submit.tsx:68`). Check: test `field.test.tsx` "describes it by the description and the error, in that order"; review.
  - Don't: `<Input aria-invalid /> <p className="text-xs text-destructive">Enter a valid email</p>`
  - Do: `<Input type="email" /> <FieldError>Enter an address with a domain, such as ada@example.com.</FieldError>`
- `rule/input-in-a-form`: When fields submit together, put them in one `<form>` with one `type="submit"` button instead of a `div` whose button has an `onClick`, because Enter in a field submits only a form, and `required`, `type` and `pattern` are checked only on submit. Evidence: principle platform: implicit submission, Enter in a single-line field submits its form; app 3/3 examples on the Field and Input pages that submit sit in a form (`docs/system/examples/field/in-form.tsx:48`, `docs/system/examples/input/type-search.tsx:13`, `docs/system/examples/input/on-submit.tsx:50`). Check: review of every screen with a submit.
  - Don't: `<div><Input name="email" /><Button onClick={save}>Save</Button></div>`
  - Do: `<form onSubmit={save}><Input name="email" type="email" required /><Button type="submit">Save</Button></form>`
- `rule/input-keeps-the-value-on-failure`: When a submit or a request fails, keep the typed value in the field and render the error in `FieldError` beside it instead of resetting the form, because retyping moves the cost of the failure onto the user. Evidence: principle heuristic: help users recognize, diagnose and recover from errors, the entry stays for the fix; principle wcag: 3.3.1 Error identification, the item in error is identified in place. Check: review of every submit handler's failure branch.
  - Don't: `onError={() => form.reset()}`
  - Do: `onError={(message) => setError(message)}`, with the value left in the field
- `rule/input-group-one-input`: When an `InputGroup` renders, give it exactly one `InputGroupInput` and at most one addon at each end, instead of two inputs or a row of buttons, because the box draws one focus ring for one input and the addons take at most half its width, so a second addon on a side leaves the text 50 percent of a 310px field or less. Evidence: measured the 310px box at 390px, `.design-system/evidence/input-group/measure.json`; principle heuristic: consistency and standards, one box is one field. Check: review.
  - Don't: `<InputGroup><InputGroupInput /><InputGroupInput /></InputGroup>`
  - Do: `<InputGroup><InputGroupAddon><SearchIcon aria-hidden="true" /></InputGroupAddon><InputGroupInput type="search" aria-label="Search filings" /><InputGroupAddon align="end"><InputGroupButton aria-label="Clear search"><XIcon aria-hidden="true" /></InputGroupButton></InputGroupAddon></InputGroup>`
- `rule/input-group-button-is-named`: When an `InputGroupButton` holds only a glyph, give it an `aria-label` that names the action and its object, such as "Clear search", because the 28px button has no visible words and a screen reader otherwise says "button". Evidence: single use `docs/system/examples/input/with-addons.tsx:24`; principle wcag: 4.1.2 Name, Role, Value. Check: test input-group.test.tsx; review.
  - Don't: `<InputGroupButton onClick={clear}><XIcon /></InputGroupButton>`
  - Do: `<InputGroupButton aria-label="Clear search" onClick={clear}><XIcon aria-hidden="true" /></InputGroupButton>`

### Content
- Follows `rule/writing-field-label-noun`.
- Follows `rule/writing-placeholder-not-label`.
- `rule/input-search-name-is-the-object`: When a search Input has no visible label, its `aria-label` and its placeholder read "Search {objects}", such as "Search members", instead of "Search..." or "Type here", because the name is all a screen reader gets and the object says what the results are. Evidence: app 2/2 search fields without a visible label on this page (`docs/system/examples/input/type-search.tsx:20`, `docs/system/examples/input/with-addons.tsx:17`), and the same template holds for any list the field filters; principle wcag: 2.4.6 Headings and labels, a label describes the purpose. Check: review of every `type="search"`.
  - Don't: `<Input type="search" placeholder="Search..." />`
  - Do: `<Input type="search" aria-label="Search members" placeholder="Search members" />`
- `rule/input-group-unit-is-a-word`: When an addon shows text, such as a fixed prefix or a unit, write the words the reader says, such as "stays.example/" or "per night", in sentence case, instead of a symbol the label does not explain or a capitalised code, because the addon is read in place beside the text. Evidence: single use `docs/system/examples/input/align-start.tsx:10`, the one text addon in the examples, since a unit beside a number goes through NumberField's `format`; principle heuristic: match between system and the real world. Check: review.
  - Don't: `<InputGroupAddon>/LST</InputGroupAddon>`
  - Do: `<InputGroupAddon>stays.example/</InputGroupAddon>`

### Anti-slop
- `rule/input-no-border-or-ring`: When an Input or an InputGroup needs to look focused or bordered, leave it: no `border-input`, no `focus-visible:ring-*` and no `shadow-*` through `className` on the Input, the InputGroup or its input, because the field already draws the accent edge and ring when you Tab into it (`field-focus`), on the box for a group, and a second border or ring doubles it. Evidence: person D40; measured 1 ring on the group's box after Tab and 0 after a click, `.design-system/evidence/input-group/measure.json`; app 0/39 Input and 0/3 InputGroupInput uses in the examples add a border or a ring (`rg -n "<Input\b" docs/system/examples`). Check: lint rule/component-override (scripts/check-system.mjs).
  - Don't: `<Input className="border border-input bg-background focus-visible:ring-2 focus-visible:ring-ring" />`
  - Do: `<Input />`
- `rule/input-affix-inside-the-box`: When an icon, a prefix or a button belongs to a text field, put it in an `InputGroupAddon` inside `InputGroup` instead of a sibling beside the box or an `absolute` icon over an Input with `pl-9`, because the group makes a press on the glyph or the padding focus the input and draws the Tab ring around the whole box, and a hand-placed icon does neither. Evidence: measured focus in the input after 1 press on the glyph, `.design-system/evidence/input-group/measure.json`; principle input: pointer, the box is the hit area the user reads as the field, so what sits in it must focus it; principle wcag: 2.5.8 Target size (minimum), the affix adds to the target instead of splitting it; single use `docs/system/examples/blocks/screener.tsx:942`, the hand-rolled stray, allowlisted. Check: review of every Input with an icon; lint rule/component-override on `pl-9`.
  - Don't: `<div className="relative"><SearchIcon className="absolute left-3" /><Input className="pl-9" /></div>`
  - Do: `<InputGroup><InputGroupAddon><SearchIcon aria-hidden="true" /></InputGroupAddon><InputGroupInput type="search" aria-label="Search filings" /></InputGroup>`
- `rule/input-no-autofocus-on-a-page`: When an Input sits on a page, leave `autoFocus` off unless typing is the only thing to do there, such as a page that is one search field, because a phone raises its keyboard over the screen before the user asked. Evidence: principle platform: iOS and Android raise the keyboard when a field takes focus; app 0/39 Input uses in the examples set `autoFocus`. Check: lint trap/touch-autofocus (scripts/check-system.mjs).
  - Don't: `<Input autoFocus placeholder="Search members" />`
  - Do: `<Input type="search" aria-label="Search members" placeholder="Search members" />`
- `rule/input-group-search-is-named`: When an `InputGroup` holds a search with a glyph and no visible label, name the input with `aria-label` that says what it searches, such as "Search filings", instead of relying on the glyph or the placeholder, because the glyph is hidden from screen readers and a placeholder goes when you type. Evidence: single use `docs/system/examples/input/with-addons.tsx:17`, the one search InputGroup in the examples, named; principle wcag: 3.3.2 Labels or Instructions. Check: review; a11y scan of the page.
  - Don't: `<InputGroupInput type="search" placeholder="Search" />`
  - Do: `<InputGroupInput type="search" aria-label="Search filings" placeholder="Search filings" />`

### Limits
- `rule/input-placeholder-length`: When a placeholder would run past 35 characters at 390px, move the hint to `FieldDescription` instead, because the box cuts the placeholder at 36 characters (290px of text in a 284px inner width at 16px), and the ellipsis it ends in hides the rest of the hint. Evidence: measured clip at 36 characters in a 308px field at 390px, .design-system/evidence/input/grow-placeholder-390.json. Check: probe .design-system/scripts/grow-inputs.mjs on the showcase at 390.
  - Don't: `<Input placeholder="Search by member name, email address or office" />`
  - Do: `<Input placeholder="Search members" />`
- `rule/input-group-addon-width`: When an addon's text would take more than half the box, such as a 70-character address prefix in a 310px field, shorten it or move it into the label instead, because the addon stops at half the box's inner width and ends in an ellipsis, so the part the reader needs may be cut. Evidence: measured the worst-case prefix cut to 143px, 46 percent of the 310px box, at 390px, `.design-system/evidence/input-group/measure.json`. Check: probe /stress/input-group?data=worst.
  - Don't: `<InputGroupAddon>https://bookings.northwind-industries-holdings.example.com/listings/</InputGroupAddon>`
  - Do: `<FieldLabel>Listing address on bookings.example</FieldLabel>` with the addon listings/

## Accessibility
Rests on `<input>` from Base UI `Input`; an InputGroup puts it inside a `div` with `role="group"`. Focus is shown by the caret, and after the Tab key also by the `--primary` edge and ring, red on an invalid field (D40); a click shows only the caret, and the fill does not change.

### Keyboard
| Key | Where focus is | Effect | Focus after | Checked by |
|---|---|---|---|---|
| Tab | before the field | focuses it, places the caret and draws the edge and ring | the field | by hand |
| typing | the field | edits the value | the field | by hand |
| Enter | the field, inside a form | submits the form | where the submit sends it, or the first field the browser reports invalid | by hand |
| Escape | a `type="search"` field | clears the value, the browser's own behaviour | the field | by hand |
| Tab | the input of an InputGroup | moves to an `InputGroupButton` inside, which draws the shared outline inside the box | the button | by hand |
| Enter or Space | an `InputGroupButton` | runs its action, such as Clear | the button, or the input when the action moves it there | by hand |

### ARIA
| Part | Role | Accessible name from | States and properties | Announced | Checked by |
|---|---|---|---|---|---|
| root | textbox, or searchbox for `type="search"` | the `Label` through `htmlFor`, `FieldLabel`, or `aria-label` | `aria-invalid`, `aria-describedby`, `disabled`, `readonly`, `required` | the name, the role, the value, "invalid entry" when invalid, then the description and the error | a11y scan |
| placeholder | none | its text | `placeholder` | read as a hint on focus while the field is empty, never as the name | by hand |
| InputGroup box | group | none; the input carries the name | none | nothing of its own | test |
| addon glyph | none, `aria-hidden` | none | none | nothing | by hand |
| addon text | none | none | none | read in reading order beside the input | by hand |
| InputGroupButton | button | its text or `aria-label` | `disabled` | the name and "button" | test |

Contrast, measured on the showcase at 390px (.design-system/evidence/input/contrast-390.json): the placeholder on the fill 5.13:1 light and 6.6:1 dark; the value on the fill 16.9:1 light and 16.33:1 dark; the value on the invalid wash 15.37:1 light and 17.14:1 dark; the disabled value 3.62:1 light and 5.1:1 dark, exempt as a disabled control (WCAG 1.4.3).

## Tokens
| Part | State | Token |
|---|---|---|
| root | all | `--control`, `--r-control`, `--input` at 50 percent, `--foreground`, `--t-press`, `--curve` |
| root | focus after Tab | `--primary` for the 1px edge and, at 20 percent, the 3px ring |
| root | below md | `text-base`, measured 16px at 390px |
| root | md and up | `text-sm` |
| placeholder | empty | `--muted-foreground` |
| root | invalid | `--destructive` at 10 percent, `--foreground` |
| root | invalid focus after Tab | `--destructive` for the edge and, at 20 percent, the ring |
| root | disabled | opacity 50 percent |
| file button | `type="file"` | `--foreground`, `text-sm`, `font-medium` |
| InputGroup box | all | the root's tokens, drawn on the box: `--control`, `--r-control`, `--input` at 50 percent, the Tab ring, the invalid wash and the disabled opacity |
| addon | all | `--muted-foreground` |
| InputGroupButton | rest | `--muted-foreground`, `--r-control-sm`, 28px |
| InputGroupButton | hover | `--muted`, `--foreground` |

The box is 36px tall beside a 36px Button in `docs/system/examples/field/in-form.tsx` (measured, .design-system/evidence/field/states-390.json), so a row of controls lines up (`trap/control-height`). In an InputGroup the glyph sits 12px from the box's edge with 8px to the text, and the button is 28px, 4px from the box's end (`.design-system/evidence/input-group/measure.json`).

## Related
- Field: the Input with its label, description and error wired.
- Textarea: text that runs past one line.
- DatePicker: a day in a form field, chosen from a calendar.
- CommandPalette: a search over the whole app, opened with Command K.
- CopyButton: copies a value, such as one in a read-only field.
- Combobox: a value picked by typing into a list too long to scroll.
- FilterBar: filters over a list, beside a search field.
- NumberField: a count or an amount nudged with a minus and a plus.
- Composer: a message with its files and a send button.
- InlineEdit: a value edited where it is read, saved on Enter or when the field is left.
- InviteField: email addresses typed or pasted as chips, with a role, to invite people.
