Base · Forms
Input
A single-line text field.
HTML / JSDraftReactStableReact NativeDraftSwift (SwiftUI)PlannedGodotPlannedVueDraftSvelteDraftSolidDraft
Reviewed
Props
tsx
import { Input } from "@/components/ui/input"
<Input placeholder="you@company.com" aria-label="Email" />Overview
Inputs collect short, free-form text: a name, an email address, a search term. Pair every input with a visible label, and use the type that matches the data so mobile keyboards and autofill behave correctly.
When to use
- For a single line of free-form text or a number.
- Set the type (email, password, number, search) so the right keyboard and validation appear.
- Wrap it in a Field when it needs a label, help text or an error message.
When not to use
- For more than one line of text: use Textarea.
- When the answer is one of a known set: use Select, Radio Group or Combobox.
- For a one-time passcode: use Input OTP.
Anatomy
Field
The bordered container the user types into. Height comes from size.control.md.
Value or placeholder
Placeholder text is a hint, never a replacement for a label.
Props
The contract every language implements. Names follow each language’s conventions (camelCase in React, snake_case in Rust).
| Prop | Type | Default | Description |
|---|---|---|---|
| type | "text" | "email" | "password" | "number" | "search" | text | The kind of data, which sets the keyboard and browser behavior. |
| placeholder | string | you@company.com | Hint shown while the field is empty. |
| disabled | boolean | false | Prevents editing and dims the field. |
| invalid | boolean | false | Marks the value as failing validation. |
| value | string | – | The current text, when controlled. |
| onChange | function | – | Called as the text changes. `onChangeText` in React Native, `oninput` in Dioxus. |
States
- Rest
- Border in color.border.input.
- Focus
- Border and 3px ring in color.border.focus.
- Invalid
- Border and ring switch to the danger intent.
- Disabled
- 50% opacity; the field cannot be focused or edited.
Accessibility
Role: textbox
| Keys | Action |
|---|---|
| Tab | Moves focus into and out of the field. |
- Always provide a label: a visible Label linked by id, or an accessible name.
- Describe errors in text next to the field; the invalid state alone is not enough.
- On the web, text is at least 16px on small screens so iOS Safari does not zoom the page on focus.
Design tokens
Change any of these in Foundations and this component follows, in every language.
Platform notes
- HTML / JS
- Draft
- A native <input>: `type` is the input's own type attribute and `invalid` is aria-invalid="true".
- React
- Stable
- Matches the contract with no platform differences.
- React Native
- Draft
- Wraps TextInput. `type` maps to keyboardType and secureTextEntry.
- Swift (SwiftUI)
- Planned
- Not built in Swift yet.
- Godot
- Planned
- Not built in Godot yet.
- Vue
- Draft
- Usage snippet only; same props and behavior as the React component.
- Svelte
- Draft
- Usage snippet only; same props and behavior as the React component.
- Solid
- Draft
- Usage snippet only; same props and behavior as the React component.