[Components](https://oods-foundry.com/components) / primitive

# Input

Edits a scalar value with a labelled native input.

Generated from @oods/foundry 0.10.1

- Categories

  primitive

- Contexts

  form

- Readiness

  `proven-in-generated-apps`

## Playground

Documented example `input-invalid` : replace value with user\@example.com, new value emitted.

The render follows the page's theme switch: light, dark or high contrast. Both frameworks render the same example.

The real Input, live

React

Email

Use a work address

Enter a valid email

Vue

Email

Use a work address

Enter a valid email

Events it emits: input, change, update. Use either render above, and each event shows here with the framework that sent it.



## Code

The documented example. HTML is the markup the React component renders for it, which @oods/component-styles styles.

**React**

```
import { Input } from '@oods/components-react';
import '@oods/component-styles/css';

const validation = {
  "state": "error",
  "message": "Enter a valid email"
};

export function Example() {
  return (
    <Input
      id="email"
      label="Email"
      type="email"
      value="invalid"
      required={true}
      help="Use a work address"
      validation={validation}
    />
  );
}
```

## Props, slots and events

Contract version 1.1.0. Types are from the React declarations in @oods/components-react.

Props

| Prop | Type | Required | Documented example |
| - | - | - | - |
| `id` | `string` | yes | `email` |
| `label` | `ReactNode` | yes | `Email` |
| `type` | `HTMLInputTypeAttribute \| undefined` | no | `email` |
| `value` | `string \| number \| readonly string[] \| undefined` | no | `invalid` |
| `defaultValue` | `string \| number \| readonly string[] \| undefined` | no | |
| `placeholder` | `string \| undefined` | no | |
| `required` | `boolean \| undefined` | no | `true` |
| `disabled` | `boolean \| undefined` | no | |
| `readOnly` | `boolean \| undefined` | no | |
| `help` | `ReactNode` | no | `Use a work address` |
| `validation` | `FieldValidation \| undefined` | no | `{"state":"error","message":"Enter a valid email"}` |

### Slots

label, help, validation

### Events

input, change, update

## States

empty, valued, disabled, readOnly, invalid

## Accessibility

- Role

  `textbox`

- How it gets its name

  `label` on `input`

### Keyboard

Keyboard

| Key | What it does |
| - | - |
| `Tab` | Move focus to the named native control |
| `x` | Edit the named control |

### Obligations in the contract

- Native input semantics
- Label and help/error descriptions are programmatically associated

Canonicalizes TextField; TextField remains a non-counting compatibility alias.

## Tokens

The token roles this component reads.

- `input.background`
- `input.border`
- `input.text`
- `input.placeholder`
- `input.focus`
- `field.message`

## Readiness

The evidence recorded for this component, with its label.

`proven-in-generated-apps`: catalog_list gives this label when generated React and Vue apps in the runtime sweep that ships with this version both use the component. That sweep was measured on the published 0.4.1, not on this version.

Readiness evidence

| Evidence | React | Vue |
| - | - | - |
| state | implemented-evidence-complete | implemented-evidence-complete |
| versioned contract | passed | passed |
| target implementation | passed | passed |
| package export | passed | passed |
| public declaration | passed | passed |
| dependency closure | passed | passed |
| framework scenario | passed | passed |
| accessibility | verified | verified |
| interaction | verified | verified |
| visual themes | verified | verified |

## Use your own

You can replace this component with your own React or Vue component. Map it, and generated code imports yours at the exact version you name. A contract report, run in a real browser, lists what your component met, what it didn't, and what wasn't checked.

The `component_map` call, with the parts in angle brackets yours to fill:

```
{
  "action": "create",
  "apply": true,
  "externalSystem": "<your design system>",
  "externalComponent": "<YourInput>",
  "oodsTraits": [
    "<trait names>"
  ],
  "substitution": {
    "component": "Input",
    "react": {
      "package": "<your-package>/react",
      "version": "<exact version>",
      "export": "<YourInput>"
    },
    "vue": {
      "package": "<your-package>/vue",
      "version": "<exact version>",
      "export": "<YourInput>"
    }
  }
}
```

## How this page was made

Generated at build from the published data, each source with the hash of what was read. [The page's manifest](https://oods-foundry.com/components/input/manifest.json).

- **Contract**: `@oods/component-contracts@0.10.1 componentContracts.Input` `sha256:b339041f21af…`
- **Documented example**: `@oods/component-contracts@0.10.1 sharedScenarios input-invalid` `sha256:c08a809836ca…`
- **Catalog entry (catalog_list)**: `generated/0.10.1/system/catalog.json Input` `sha256:1a19e7f7c222…`
- **React readiness**: `@oods/components-react@0.10.1 readiness Input` `sha256:b170deb5f602…`
- **Vue readiness**: `@oods/components-vue@0.10.1 readiness Input` `sha256:6d097cac23fa…`
- **Prop types**: `generated/0.10.1/components/prop-types.json Input` `sha256:d8c2388a1227…`
