# Input

A text input that works with Field and your own validation.

- **Use it for**: A single line of free text, inside a Field.
- **Not for**: Long text or a value chosen from a list. Try [Textarea](https://unseenui.com/components/textarea/), [Select](https://unseenui.com/components/select/), [Combobox](https://unseenui.com/components/combobox/).

## Installation

```bash
npm install @stackunseen/ui
```

## Usage

```tsx
import { Input } from '@stackunseen/ui';
import { Field } from '@stackunseen/ui';
import '@stackunseen/ui/styles.css';

<Field label="Project name"><Input value={name} onChange={event => setName(event.target.value)} /></Field>
```

## Props

- `value` (`string | number | readonly string[] (optional)`): The controlled value. For a text field, keep a string in application state.
- `onChange` (`(event: ChangeEvent<HTMLInputElement>) => void (optional)`): Read event.currentTarget.value to update your controlled text value.
- `type` (`HTMLInputTypeAttribute (optional)`): Defaults to text. Choose email, password or another native input type as needed.
- `name` (`string (optional)`): The key used in native form data.
- `required` (`boolean (optional)`): Enables native required validation. Validate application rules separately.
- `disabled` (`boolean (optional)`): Blocks editing and excludes the input from native form submission.

## Keyboard

Tab focuses the native control. Labels are associated with their inputs; disabled controls leave the tab order. Error text remains available through aria-describedby.

## Works with

[Field](https://unseenui.com/components/field/), [Textarea](https://unseenui.com/components/textarea/), [Select](https://unseenui.com/components/select/), [Checkbox](https://unseenui.com/components/checkbox/), [Switch](https://unseenui.com/components/switch/), [Alert](https://unseenui.com/components/alert/), [Button](https://unseenui.com/components/button/), [RadioGroup](https://unseenui.com/components/radio-group/), [TonePad](https://unseenui.com/components/tone-pad/), [Slider](https://unseenui.com/components/slider/), [InputGroup](https://unseenui.com/components/input-group/), [Combobox](https://unseenui.com/components/combobox/)

Page: https://unseenui.com/components/input/
