invalid
boolean
Renders a text input, providing the ability to specify the type. Use the autoComplete prop to specify an appropriate value and assist users with their data entry.
<TextInputaria-label="awesome text input"id="text-input-1"name="text-input-1"type="text"/>
<FormControl><InputLabel htmlFor="text-input-2">First Name</InputLabel><TextInputid="text-input-2"name="text-input-2"type="text"/></FormControl>
<TextInput>
also facilitates an optional icon to be shown before the input itself.
<TextInputaria-label="awesome email input"id="text-input-3"name="text-input-3"startIcon={<ChatIcon />}type="email"/>
If the <TextInput>
value does not meet validation requirements this can also be set. Best used in conjunction with <FormControl>.
<TextInputaria-label="awesome email input"id="text-input-4"invalidname="text-input-4"type="email"/>
If the <TextInput>
meets validation requirements this can also be set. Best used in conjunction with <FormControl>.
<TextInputaria-label="awesome email input"id="text-input-5"name="text-input-5"successtype="email"/>
TextInput with a placeholder. Be careful when using __dangerousPlaceholder
, this is only a visual addition. When using __dangerousPlaceholder
it should always be complemented with an ariaLabel or a label element. See W3 - placeholder-text or Smashingmagazine - placeholder-attribute for more information about placeholders.
<TextInput__dangerousPlaceholder="This is a placeholder"aria-label="awesome input"id="text-input-5"name="text-input-5"type="text"/>
Valid for text
, search
, url
, tel
, email
, and password
, the pattern attribute defines a regular expression that the input's value must match in order for the value to pass constraint validation. See MDN - pattern for more information about patterns.
<TextInputaria-label="awesome text input"id="text-input-6"name="text-input-6"pattern="[0-9]{3}-[0-9]{2}-[0-9]{4}"type="tel"/>
<TextInputaria-label="awesome text input"id="text-input-7"name="text-input-7"type="text"><Button icon={<SearchIcon />}>Search</Button></TextInput>
invalid
boolean
success
boolean
startIcon
ReactNode
__dangerousPlaceholder
string
Renders a placeholder inside the input. This is only a visual addition. When using a placeholder it should always be complemented with an ariaLabel or a label element. @see https://www.w3.org/WAI/tutorials/forms/instructions/#placeholder-text
atoms
Applies permitted design system styles. See styling documentation for more.