Components · Form & Input
Input
Text input field for forms. Supports size variants, icons, addons, and validation states.
import { Input } from '@nexub/react';Usage
Capturing short free-form text (name, email, search term)
Single-line data entry within a form
Filtering or searching a list of items
Inline editing of a single value
Multi-line text — use Textarea instead
Choosing from a fixed list of options — use Select or Combobox
Numeric stepping — use NumberInput for increment/decrement control
Passwords — use PasswordInput which toggles visibility
Playground
Playground
Live<Input size="md" placeholder="Enter value…" />Examples
Default
Sizes
Invalid state
With label and helper
States
defaultdisabledinvalidloadingsize="sm"size="md"size="lg"
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| size | 'sm' | 'md' | 'lg' | 'md' | Control height and font size. |
| invalid | boolean | — | Applies error ring styling. |
| disabled | boolean | false | Disables the input. |
| placeholder | string | — | Placeholder text. |
| type | string | 'text' | HTML input type attribute. |
| leadingIcon | React.ReactNode | — | Icon rendered at the start of the input. |
| trailingIcon | React.ReactNode | — | Icon rendered at the end of the input. |
| leadingAddon | string | — | Text addon rendered before the input (e.g. "https://"). |
| trailingAddon | string | — | Text addon rendered after the input (e.g. ".com"). |
| clearable | boolean | — | Shows a clear button while there is a value. Clearing fires onChange with "". |
| loading | boolean | — | Spinner in the trailing slot and aria-busy on the input. |
| showCount | boolean | — | Shows a "12/80" counter; needs maxLength. Announced politely near the limit. |
| wrapperClassName | string | — |
Design tokens
Input reads these component tokens. Each one is unset by default and falls back to the semantic role it aliases, so nothing changes until you set it. Set one on any element to restyle every Input below it, and leave the roles other components share alone. See the three token tiers.
Input, Textarea, Select and Combobox triggers.
| Token | Aliases | Notes |
|---|---|---|
| --field-bg | --color-surface-container-lowest | — |
| --field-fg | --color-on-surface | — |
| --field-border | --color-outline | — |
| --field-radius | --shape-field | — |
/* One area of your app */
.checkout {
--field-bg: var(--color-secondary);
}Accessibility
ARIA roles
Keyboard
- Tab
Moves focus to the input.
- Esc
Browsers may revert recent changes (autofill suggestions).
Focus
Visible focus ring on `:focus-visible`. Pair with a `<Label htmlFor>` so clicking the label moves focus into the field.
Screen reader
`invalid` toggles `aria-invalid="true"` so AT users hear the error state.
Use `aria-describedby` to associate `HelperText` or error messages.
On iOS & Android: TextField
import { TextField } from '@nexub/react-native';
<TextField label="Email" keyboardType="email-address" autoComplete="email" error={errors.email} />Web vs mobile
Same tokens and prop names. Where the platforms differ:
| Web | iOS & Android | |
|---|---|---|
| Label | Compose Label + control + HelperText (or FormField). | One component: label, helperText and error are props. |
| Keyboard | Browser keyboard. | Pass TextInput props: keyboardType, textContentType, autoComplete for autofill. |
Interactive preview of @nexub/react-native rendered for the web. Native chrome (switches, pickers, Liquid Glass) looks like the platform on a device.
On device

iPhone (iOS simulator)

Pixel (Android emulator)
Screenshots from the latest CI run of the showcase app; the live frame renders the same code for the web.
TextField props
| Prop | Type | Default | Description |
|---|---|---|---|
| ref | React.Ref<React.ComponentRef<typeof TextInput>> | — | — |
| labelrequired | string | — | Visible label above the field (also its accessible name). |
| helperText | string | — | Hint under the field. Replaced by error when set. |
| error | string | — | Error message: red outline, announced, replaces the helper text. |
| required | boolean | — | Shows a required marker after the label, like web FormField. Checking the value is up to you. |
| disabled | boolean | — | — |
| size | Extract<ControlSize, 'sm' | 'md' | 'lg' | 'xl'> | 'lg' | Field height, the same names as web Input's size: sm and md are the compact desktop
heights, lg the mobile field height (48), xl the large touch height. |
| invalid | boolean | — | Red outline and announced as invalid, with or without an error message. |
| readOnly | boolean | — | Shows the value but it can't be changed. The field can still be focused and its text selected and copied; it sits on a quieter surface so it doesn't look editable. |
| leadingIcon | React.ReactNode | — | An icon (or any small node) at the start, inside the field. |
| trailingIcon | React.ReactNode | — | An icon (or any small node) at the end, inside the field, after the clear button. |
| leadingAddon | React.ReactNode | — | Text or a node in its own segment before the field, e.g. "https://". |
| trailingAddon | React.ReactNode | — | Text or a node in its own segment after the field, e.g. ".com" or "kg". |
| leading | React.ReactNode | — | The older name for leadingIcon: a node at the start, inside the field. |
| trailing | React.ReactNode | — | The older name for trailingIcon: a node at the end, inside the field. |
| clearable | boolean | — | Shows a clear button while there is a value. Clearing fires onChangeText with "". |
| onClear | () => void | — | Called when the clear button empties the field, after onChangeText(""). |
| showCount | boolean | — | Shows a "12/80" counter; needs maxLength. Announced politely near the limit. |
| loading | boolean | — | Spinner in the trailing slot and busy for screen readers. |
| streaming | boolean | — | 12.5: an agent is filling this field. Busy for screen readers, with a calm shimmer on the field (none under Reduce Motion); it stays editable. Pass the value as it arrives. |
| generated | boolean | — | 12.5: the value came from an agent. Shows a "Suggested" mark beside the label, read as part of the field's hint. Typing in the field clears the mark; so do accept and clear. |
| onAcceptSuggestion | () => void | — | 12.5: with generated, shows an accept button beside the mark. |
| onClearSuggestion | () => void | — | 12.5: with generated, shows a clear button beside the mark. Clear the value here. |
| style | StyleProp<ViewStyle> | — | — |