TextField
A wrapper around React Aria’s TextField component. Manages label association,
validation state, and error messages automatically.
Add via CLI
Section titled “Add via CLI”npx @a2ra/cli add text-fieldDisabled state
Section titled “Disabled state”With validation error
Section titled “With validation error”Example JSON
Section titled “Example JSON”{ "type": "TextField", "props": { "label": "Email address", "type": "email", "name": "email", "isRequired": true, "description": "We'll never share your email." }}| Prop | Type | Description |
|---|---|---|
label | string | Visible label (required for accessibility) |
placeholder | string | Placeholder text |
type | text defaultemailpasswordnumbertelurl | Input type |
name | string | Form field name |
value | string | Controlled value |
defaultValue | string | Uncontrolled default |
autoComplete | string | Browser autocomplete hint |
inputMode | textnumericdecimalemailtelurlsearch | Virtual keyboard hint |
minLength | number | Minimum character length |
maxLength | number | Maximum character length |
pattern | string | Regex validation pattern |
isDisabled | truefalse default | Disables the input |
isRequired | truefalse default | Marks field as required |
isReadOnly | truefalse default | Prevents editing |
isInvalid | truefalse default | Shows error styling |
autoFocus | truefalse default | Focuses the field on mount |
validationBehavior | aria defaultnative | Validation reporting strategy |
description | string | Helper text shown below the input |
errorMessage | string | Error text shown when isInvalid is true |
- Always provide a
label. React Aria associates it with the input via ARIA attributes. errorMessageis only shown whenisInvalid: true.- Use
validationBehavior: "native"for HTML form constraint validation with browser-native messages.