Skip to main content
← All Demos

Input

Input combines field, label, hint, and error parts for collecting and validating user text input.

1. Basic Input with Label

Label is automatically linked to the field. Clicking the label focuses the input. aria-labelledby and aria-describedby are set automatically.

Your unique username for login
Test: Click the label → input should focus. Screen reader should read label + description.
<Field>
  <Field.Label>Username</Field.Label>
  <Input>
    <Input.Field placeholder='Enter your username' />
  </Input>
  <Field.Description>Your unique username for login</Field.Description>
</Field>

2. Required Input

Uses aria-required on the field. Screen readers announce as required.

We'll never share your email
<Field required>
  <Field.Label>Email *</Field.Label>
  <Input>
    <Input.Field type='email' placeholder='Required field' />
  </Input>
</Field>

3. Invalid Input with Error Message

When invalid, the error message is linked via aria-errormessage or aria-describedby. The error uses role="alert" for live announcement.

Enter a valid email address
Screen reader: Error message should be announced when it appears.
<Field invalid={invalid} required>
  <Field.Label>Email</Field.Label>
  <Input>
    <Input.Field value={value} onChange={handleChange} />
  </Input>
  <Field.ErrorMessage>Please enter a valid email</Field.ErrorMessage>
</Field>

4. Disabled Input

Disabled inputs cannot be focused or edited.

Contact support to change your organization
Expected: Tab should skip the disabled input.
<Field disabled>
  <Field.Label>Organization</Field.Label>
  <Input>
    <Input.Field value='Acme Corporation' />
  </Input>
</Field>

5. Read-only Input

Read-only inputs are focusable and selectable but cannot be edited. Uses aria-readonly.

This value cannot be changed
<Field readOnly>
  <Field.Label>Account ID</Field.Label>
  <Input>
    <Input.Field value='ACC-2025-XYZ' />
  </Input>
</Field>

6. Auto Focus Input

Input that automatically receives focus on mount.

<Field>
  <Field.Label>Search</Field.Label>
  <Input>
    <Input.Field placeholder='I should be focused' autoFocus />
  </Input>
</Field>
← All Demos