Use FormControl instead.
Every input must have a corresponding label to be accessible to assistive technology. That's why you'd use InputField
instead of using TextInput
directly.
InputField
also provides an interface for showing a hint text caption and a validation message, and associating those with the input for assistive technology.
The container that handles the layout and passes the relevant IDs and ARIA attributes it's children.
Name | Type | Default | Description |
---|---|---|---|
children Required | InputField.Label | InputField.Caption | InputField.Validation | Autocomplete | TextInput | TextInputWithTokens | Select | ||
disabled | boolean | false | Whether the field is ready for user input |
id | string | a generated string | The unique identifier for this field. Used to associate the label, validation text, and caption text |
required | boolean | false | Whether the field is ready for user input |
validationMap | Record<string, 'error'|'success'> | A map of validation statuses and their associated validation keys. When one of the validation keys is passed to the | |
validationResult | string | The key of the validation message to show |
A InputField.Label
must be passed for the field to be accessible to assistive technology, but it may be visually hidden.
Name | Type | Default | Description |
---|---|---|---|
boolean | InputField.Label | InputField.Caption | InputField.Validation | Autocomplete | TextInput | TextInputWithTokens | false | Whether the label should be visually hidden |
InputField.Caption
may be used to render hint text for fields that require additional context.
Name | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | The content (usually just text) that is rendered to give contextual info about the field |
InputField.Validation
may be used to render contextual validation information if the field was flagged during validation.
Name | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | The content (usually just text) that is rendered to give contextual info about the validation result for the field | |
validationKey | string | The key of the property from |