Note TextField extends props from HTMLInputElement on web. On mobile, it extends TextInputProps from react-native.
Input Label
Default composition of Inputs.
Accessible Text Inputs
TextInput comes with an accessibilityLabel prop. If no accessibilityLabel is passed, it will use the label as the accessibilityLabel. If you want an accessibilityLabel that differs from the Label, you can set this prop.
Here, since no accessibilityLabel is passed, the accessibilityLabel will be "Email".
Example of passing an accessibilityLabel. For web, this will set aria-label="Enter a Coinbase Email" under the hood
Like any component system, much of the responsibility for building accessible UIs is in your hands as the consumer to properly implement the component composition. We'll do our best to provide sane fallbacks, but here are the biggest gotchas for TextInputs you can watch out for.
aria-* attr overrides
Any time you use variant='negative', we assume you're showing an error state. If for some reason this is not the case, you will want to use aria-invalid={false} to override the default configuration.
Message format
It's also advised you always format helperText with Error: ${errorMessage}. We'd do that for you, but i18n isn't baked into CDS. Take a look at the example below:
Placeholder Text
Borderless TextInput (web)
A borderless TextInput SHOULD NOT be used alone. It should be used with a TypeAhead component.