Components · Form & Input
Form Field
StableAdded v0.0.1
Wraps Label, Input, HelperText and FormError into a single accessible group.
import { FormField } from '@nexub/react';Examples
Default
Agent states
`streaming` while an agent types into the field, then `generated` with accept and clear. The person can edit at any time; editing drops the "Suggested" mark. Strings come from `suggested`, `acceptSuggestion` and `clearSuggestion` in messages.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | — | Name attribute forwarded to the underlying input. |
| id | string | — | Explicit id for the input; defaults to the name value. |
| required | boolean | — | Marks the field as required and renders a required indicator on the label. |
| streaming | boolean | — | An agent is filling the field (12.4): aria-busy and a calm shimmer on the control. Pass the value as text arrives; the control stays editable. |
| generated | boolean | — | The value came from an agent (12.4): a "Suggested" mark beside the label, read as part of the control's description. Editing the value clears it; turning generated off and on shows it again. |
| onAcceptSuggestion | (() => void) | — | With generated: an accept button beside the mark. Clears the mark and keeps the value. |
| onClearSuggestion | (() => void) | — | With generated: a clear button beside the mark. Clear the value here; the mark goes too. |
| disabled | boolean | — | |
| invalid | boolean | — |
On iOS & Android: TextField
@nexub/react-nativeAlpha
import { TextField } from '@nexub/react-native';
<TextField label="Full name" helperText="As on your NRIC" />
<TextField label="Title" value={title} onChangeText={setTitle} generated={fromAgent} onAcceptSuggestion={keep} onClearSuggestion={() => setTitle('')} />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. |
| Agent states | streaming shimmers the control; generated adds a "Suggested" mark read through aria-describedby. | The same props on TextField (12.5): busy with a calm wash (none under Reduce Motion); the mark is read as part of the field's hint, and accept / clear move the screen reader to the field. |
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> | — | — |