Skip to content

Input Fields

Edit on GitHub

Input fields allow users to enter text, dates, and other structured data within a form. Each field type includes clear labeling and validation to support a consistent, accessible experience.

@volvo-cars/css v2.5.1@volvo-cars/react-forms v2.0.1

Input components from @volvo-cars/react-forms share a common label, validation, and hint API. The default variant places a static label above the field.

Show codeHide code
import { TextInput } from '@volvo-cars/react-forms';
export function TextInputBasic() {
return <TextInput name="full-name" label="Full name" variant="top-label" />;
}

Inputs use native HTML attributes and behaviors wherever possible, so browser autofill, native date pickers, and constraint validation work without extra wiring.

When none of the built-in types fit. A multi-select dropdown or an advanced search filter, for example. Build a custom input on the content slots rather than replacing the field.

Set variant="floating-label" for a label that animates from inside the input to above it on focus.

Each component maps to the appropriate HTML type, inputMode, and autoComplete attributes for browser validation and mobile keyboards.

ComponentHTML typeUse case
TextInputtextGeneral text
EmailInputemailEmail addresses
PasswordInputpassword / textPasswords (with show/hide)
TelInputtelPhone numbers
UrlInputurlURLs
DateInputdateDate with calendar picker
CurrencyInputtext (numeric)Monetary values with symbol
UnitInputtext (numeric)Values with localised unit
TextArea<textarea>Multi-line text

Includes a built-in show/hide toggle. Pass showPasswordLabel to make the toggle accessible. Without it, the button is hidden from assistive technology.

Renders a native date picker with a calendar icon button. Use min and max to constrain the date range in yyyy-mm-dd format.

Displays a locale-aware currency symbol as a prefix or suffix. Always uses top-label variant. Formatting follows the locale provided by LocaleProvider at the app root.

Displays a localised unit suffix. Always uses top-label variant. Set unitDisplay="long" for the full unit name. Formatting follows the locale provided by LocaleProvider at the app root.

Multi-line text input for longer content like messages or feedback. Set rows to control the visible height. Supports both top-label and floating-label variants.

Use errorMessage to show an error and mark the input invalid. Use hint for supplementary guidance. Both render below the input and are linked via aria-describedby.

By default inputs are uncontrolled. Set defaultValue for an initial value. Pass value + onChange for controlled usage.

contentAfter injects an element (typically an Icon or IconButton) at the end of the input field. contentBefore does the same at the start but is only supported with variant="top-label".

PasswordInput, DateInput, CurrencyInput, and UnitInput use these slots internally. You don’t need to wire them yourself.

A <label> followed by an <input> without a class attribute is styled automatically when its type is text, email, password, tel, url, date, or datetime-local.

Show codeHide code
<label for="css-name" class="font-medium">Full name</label>
<input type="text" id="css-name" />

For the floating label pattern, wrap a <label> and <input> in a div.input-floating-label and set placeholder=" " (a space) to drive the CSS state.

Key consumer responsibilities from the WCAG audit:

  • Label every input: the label prop is required and renders a <label> linked to the input. If you also use aria-labelledby, the component includes both references automatically.
  • Error identification: errorMessage renders an error with an icon and links it to the input via aria-errormessage and aria-describedby. Errors are hidden when the input is disabled.
  • Status messages: VoiceOver in Safari has known issues announcing error messages. Test with multiple screen readers.
  • Password visibility: always pass showPasswordLabel on PasswordInput so the toggle button is announced. Without it the button is aria-hidden.
  • Disabled inputs: use sparingly. Prefer showing validation messages and hints to explain why a field can’t be edited.
PropTypeRequiredDefault
patternstring--
Regular expression that the input value must match.
liststring--
Id of a `<datalist>` element with a list of predefined values to suggest to the user.
sizenumber--
Specifies the visible width, in characters, of the input.
minLengthnumber--
Minimum length of the input value.
maxLengthnumber--
Maximum length of the input value.
inputMode"none" | "text" | "numeric" | "decimal"--
Hint the browser about the appropriate virtual keyboard for the type of expected data.
autoCapitalize"none" | "sentences" | "words" | "characters"--
Controls whether and how text input is automatically capitalized as it is entered by the user.
autoCorrect"off" | "on"--
Controls whether the browser should automatically correct the text as it is being entered.
spellCheckboolean--
Controls whether the element may be checked for spelling errors.
autoComplete"name" | "off" | "on" | "organization-title" | ...--
What type of information to autocomplete in the input. @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
contentBeforeReactNode--
Inject an element into the input field, displayed at the start of the input. Only supported with the `top-label` variant.
contentAfterReactNode--
Inject an element into the input field, displayed at the end of the input.
defaultValuestring--
Default value of an uncontrolled input.
valuestring--
Value of the input. Makes the input controlled.
onChangeChangeEventHandler<HTMLInputElement, Element>--
Fires immediately when the input’s value is changed by the user (for example, it fires on every keystroke).
variant"top-label" | "floating-label"-top-label
namestring-
The name of the input to use when submitting the form.
placeholderstring--
Placeholder text to show in the input when it is empty.
errorMessagestring--
Set the error message of an input and mark it invalid.
aria-invalidboolean-false
Force the input to be invalid.
hiddenboolean--
idstring--
titlestring--
dirstring--
langstring--
slotstring--
translate"yes" | "no"--
classNamestring--
styleCSSProperties--
tabIndexnumber--
onPointerDownPointerEventHandler<Element>--
onPointerEnterPointerEventHandler<Element>--
onPointerLeavePointerEventHandler<Element>--
onPointerMovePointerEventHandler<Element>--
onPointerUpPointerEventHandler<Element>--
labelstring-
A concise label for the input, keep it below 40 characters. For a large form where only some options are required, add an asterisk (*) to the end of the label. If most fields in the form are required, add (optional) to the label.
disabledboolean-false
Disables the input. Use sparingly as it can be non-obvious to users why an input has been disabled. Prefer showing validation messages and hints instead.
autoFocusboolean-false
Gives the input focus on page load. Use sparingly as it can be confusing to screen-reader and mobile users.
readOnlyboolean-false
Makes the input read-only. Use sparingly, it's often preferred to present the data as regular text or in a table instead.
formstring--
Id of a form element that this input should be associated with. Defaults to the containing form element.
hintReactNode--
Additional hint or description.
enterKeyHint"done" | "go" | "next" | "previous" | "search" ...--
Hint the browser about what label to show for the Enter button on mobile keyboards.
requiredboolean-false
Makes the input required.
aria-describedbystring--
aria-labelledbystring--
onInvalidFormEventHandler<HTMLInputElement>--
Fires if the input fails validation on form submit.
onFocusFocusEventHandler<HTMLInputElement>--
onBlurFocusEventHandler<HTMLInputElement>--
onKeyDownKeyboardEventHandler<HTMLInputElement>--
onKeyUpKeyboardEventHandler<HTMLInputElement>--
PropTypeRequiredDefault
multipleboolean--
Accept multiple comma-separated email addresses.
autoComplete"off" | "email"--
What type of information to autocomplete in the input.
minLengthnumber--
Minimum length of the email address.
maxLengthnumber--
Maximum length of the email address.
patternstring--
Regular expression that the email must match. Email pattern validation is already built into the browser, so this should only be used to for instance require that the email address ends with a specific domain.
liststring--
Id of a `<datalist>` element with a list of predefined values to suggest to the user.
contentAfterReactNode--
Inject an element into the input field, displayed at the end of the input. Usually used to display a custom `Icon` or `IconButton`.
defaultValuestring--
Default value of an uncontrolled input.
valuestring--
Value of the input. Makes the input controlled.
onChangeChangeEventHandler<HTMLInputElement, Element>--
Fires immediately when the input’s value is changed by the user (for example, it fires on every keystroke).
variant"top-label" | "floating-label"-top-label
namestring-
The name of the input to use when submitting the form.
placeholderstring--
Placeholder text to show in the input when it is empty.
errorMessagestring--
Set the error message of an input and mark it invalid.
aria-invalidboolean-false
Force the input to be invalid.
hiddenboolean--
idstring--
titlestring--
dirstring--
langstring--
slotstring--
translate"yes" | "no"--
classNamestring--
styleCSSProperties--
tabIndexnumber--
onPointerDownPointerEventHandler<Element>--
onPointerEnterPointerEventHandler<Element>--
onPointerLeavePointerEventHandler<Element>--
onPointerMovePointerEventHandler<Element>--
onPointerUpPointerEventHandler<Element>--
labelstring-
A concise label for the input, keep it below 40 characters. For a large form where only some options are required, add an asterisk (*) to the end of the label. If most fields in the form are required, add (optional) to the label.
disabledboolean-false
Disables the input. Use sparingly as it can be non-obvious to users why an input has been disabled. Prefer showing validation messages and hints instead.
autoFocusboolean-false
Gives the input focus on page load. Use sparingly as it can be confusing to screen-reader and mobile users.
readOnlyboolean-false
Makes the input read-only. Use sparingly, it's often preferred to present the data as regular text or in a table instead.
formstring--
Id of a form element that this input should be associated with. Defaults to the containing form element.
hintReactNode--
Additional hint or description.
enterKeyHint"done" | "go" | "next" | "previous" | "search" ...--
Hint the browser about what label to show for the Enter button on mobile keyboards.
requiredboolean-false
Makes the input required.
aria-describedbystring--
aria-labelledbystring--
onInvalidFormEventHandler<HTMLInputElement>--
Fires if the input fails validation on form submit.
onFocusFocusEventHandler<HTMLInputElement>--
onBlurFocusEventHandler<HTMLInputElement>--
onKeyDownKeyboardEventHandler<HTMLInputElement>--
onKeyUpKeyboardEventHandler<HTMLInputElement>--
PropTypeRequiredDefault
defaultPasswordVisibleboolean-false
Password is initially visible.
autoComplete"off" | "current-password" | "new-password"--
Pass `current-password` to autocomplete the users current password or `new-password` to autocomplete the new password in a change password form.
patternstring--
Regular expression that the password must match.
sizenumber--
Specifies the visible width, in characters, of the input.
minLengthnumber--
Minimum length of the password.
maxLengthnumber--
Maximum length of the password.
showPasswordLabelstring--
Label for the show password button.
defaultValuestring--
Default value of an uncontrolled input.
valuestring--
Value of the input. Makes the input controlled.
onChangeChangeEventHandler<HTMLInputElement, Element>--
Fires immediately when the input’s value is changed by the user (for example, it fires on every keystroke).
variant"top-label" | "floating-label"-top-label
namestring-
The name of the input to use when submitting the form.
placeholderstring--
Placeholder text to show in the input when it is empty.
errorMessagestring--
Set the error message of an input and mark it invalid.
aria-invalidboolean-false
Force the input to be invalid.
hiddenboolean--
idstring--
titlestring--
dirstring--
langstring--
slotstring--
translate"yes" | "no"--
classNamestring--
styleCSSProperties--
tabIndexnumber--
onPointerDownPointerEventHandler<Element>--
onPointerEnterPointerEventHandler<Element>--
onPointerLeavePointerEventHandler<Element>--
onPointerMovePointerEventHandler<Element>--
onPointerUpPointerEventHandler<Element>--
labelstring-
A concise label for the input, keep it below 40 characters. For a large form where only some options are required, add an asterisk (*) to the end of the label. If most fields in the form are required, add (optional) to the label.
disabledboolean-false
Disables the input. Use sparingly as it can be non-obvious to users why an input has been disabled. Prefer showing validation messages and hints instead.
autoFocusboolean-false
Gives the input focus on page load. Use sparingly as it can be confusing to screen-reader and mobile users.
readOnlyboolean-false
Makes the input read-only. Use sparingly, it's often preferred to present the data as regular text or in a table instead.
formstring--
Id of a form element that this input should be associated with. Defaults to the containing form element.
hintReactNode--
Additional hint or description.
enterKeyHint"done" | "go" | "next" | "previous" | "search" ...--
Hint the browser about what label to show for the Enter button on mobile keyboards.
requiredboolean-false
Makes the input required.
aria-describedbystring--
aria-labelledbystring--
onInvalidFormEventHandler<HTMLInputElement>--
Fires if the input fails validation on form submit.
onFocusFocusEventHandler<HTMLInputElement>--
onBlurFocusEventHandler<HTMLInputElement>--
onKeyDownKeyboardEventHandler<HTMLInputElement>--
onKeyUpKeyboardEventHandler<HTMLInputElement>--
PropTypeRequiredDefault
autoComplete"off" | "tel" | "tel-country-code" | "tel-natio...--
What type of information to autocomplete in the input. @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
minLengthnumber--
Minimum length of the telephone number.
maxLengthnumber--
Maximum length of the telephone number.
sizenumber--
Specifies the visible width, in characters, of the input.
patternstring--
Regular expression that the telephone number must match.
liststring--
Id of a `<datalist>` element with a list of predefined values to suggest to the user.
contentAfterReactNode--
Inject an element into the input field, displayed at the end of the input. Usually used to display a custom `Icon` or `IconButton`.
defaultValuestring--
Default value of an uncontrolled input.
valuestring--
Value of the input. Makes the input controlled.
onChangeChangeEventHandler<HTMLInputElement, Element>--
Fires immediately when the input’s value is changed by the user (for example, it fires on every keystroke).
variant"top-label" | "floating-label"-top-label
namestring-
The name of the input to use when submitting the form.
placeholderstring--
Placeholder text to show in the input when it is empty.
errorMessagestring--
Set the error message of an input and mark it invalid.
aria-invalidboolean-false
Force the input to be invalid.
hiddenboolean--
idstring--
titlestring--
dirstring--
langstring--
slotstring--
translate"yes" | "no"--
classNamestring--
styleCSSProperties--
tabIndexnumber--
onPointerDownPointerEventHandler<Element>--
onPointerEnterPointerEventHandler<Element>--
onPointerLeavePointerEventHandler<Element>--
onPointerMovePointerEventHandler<Element>--
onPointerUpPointerEventHandler<Element>--
labelstring-
A concise label for the input, keep it below 40 characters. For a large form where only some options are required, add an asterisk (*) to the end of the label. If most fields in the form are required, add (optional) to the label.
disabledboolean-false
Disables the input. Use sparingly as it can be non-obvious to users why an input has been disabled. Prefer showing validation messages and hints instead.
autoFocusboolean-false
Gives the input focus on page load. Use sparingly as it can be confusing to screen-reader and mobile users.
readOnlyboolean-false
Makes the input read-only. Use sparingly, it's often preferred to present the data as regular text or in a table instead.
formstring--
Id of a form element that this input should be associated with. Defaults to the containing form element.
hintReactNode--
Additional hint or description.
enterKeyHint"done" | "go" | "next" | "previous" | "search" ...--
Hint the browser about what label to show for the Enter button on mobile keyboards.
requiredboolean-false
Makes the input required.
aria-describedbystring--
aria-labelledbystring--
onInvalidFormEventHandler<HTMLInputElement>--
Fires if the input fails validation on form submit.
onFocusFocusEventHandler<HTMLInputElement>--
onBlurFocusEventHandler<HTMLInputElement>--
onKeyDownKeyboardEventHandler<HTMLInputElement>--
onKeyUpKeyboardEventHandler<HTMLInputElement>--
PropTypeRequiredDefault
multipleboolean--
Accept multiple URLs.
autoComplete"off" | "url" | "photo"--
What type of information to autocomplete in the input. @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
minLengthnumber--
Minimum length of the URL.
maxLengthnumber--
Maximum length of the URL.
patternstring--
Regular expression that the URL must match.
liststring--
Id of a `<datalist>` element with a list of predefined values to suggest to the user.
contentAfterReactNode--
Inject an element into the input field, displayed at the end of the input. Usually used to display a custom `Icon` or `IconButton`.
defaultValuestring--
Default value of an uncontrolled input.
valuestring--
Value of the input. Makes the input controlled.
onChangeChangeEventHandler<HTMLInputElement, Element>--
Fires immediately when the input’s value is changed by the user (for example, it fires on every keystroke).
variant"top-label" | "floating-label"-top-label
namestring-
The name of the input to use when submitting the form.
placeholderstring--
Placeholder text to show in the input when it is empty.
errorMessagestring--
Set the error message of an input and mark it invalid.
aria-invalidboolean-false
Force the input to be invalid.
hiddenboolean--
idstring--
titlestring--
dirstring--
langstring--
slotstring--
translate"yes" | "no"--
classNamestring--
styleCSSProperties--
tabIndexnumber--
onPointerDownPointerEventHandler<Element>--
onPointerEnterPointerEventHandler<Element>--
onPointerLeavePointerEventHandler<Element>--
onPointerMovePointerEventHandler<Element>--
onPointerUpPointerEventHandler<Element>--
labelstring-
A concise label for the input, keep it below 40 characters. For a large form where only some options are required, add an asterisk (*) to the end of the label. If most fields in the form are required, add (optional) to the label.
disabledboolean-false
Disables the input. Use sparingly as it can be non-obvious to users why an input has been disabled. Prefer showing validation messages and hints instead.
autoFocusboolean-false
Gives the input focus on page load. Use sparingly as it can be confusing to screen-reader and mobile users.
readOnlyboolean-false
Makes the input read-only. Use sparingly, it's often preferred to present the data as regular text or in a table instead.
formstring--
Id of a form element that this input should be associated with. Defaults to the containing form element.
hintReactNode--
Additional hint or description.
enterKeyHint"done" | "go" | "next" | "previous" | "search" ...--
Hint the browser about what label to show for the Enter button on mobile keyboards.
requiredboolean-false
Makes the input required.
aria-describedbystring--
aria-labelledbystring--
onInvalidFormEventHandler<HTMLInputElement>--
Fires if the input fails validation on form submit.
onFocusFocusEventHandler<HTMLInputElement>--
onBlurFocusEventHandler<HTMLInputElement>--
onKeyDownKeyboardEventHandler<HTMLInputElement>--
onKeyUpKeyboardEventHandler<HTMLInputElement>--
PropTypeRequiredDefault
minstring--
The earliest date/time to accept, in the `yyyy-mm-dd` format.
maxstring--
The latest date/time to accept, in the `yyyy-mm-dd` format.
autoCompletestring--
What type of information to autocomplete in the input.
defaultValuestring--
Default value of an uncontrolled input.
valuestring--
Value of the input. Makes the input controlled.
onChangeChangeEventHandler<HTMLInputElement, Element>--
Fires when the input’s value is changed.
variant"top-label" | "floating-label"-top-label
namestring-
The name of the input to use when submitting the form.
errorMessagestring--
Set the error message of an input and mark it invalid.
aria-invalidboolean-false
Force the input to be invalid.
hiddenboolean--
idstring--
titlestring--
dirstring--
langstring--
slotstring--
translate"yes" | "no"--
classNamestring--
styleCSSProperties--
tabIndexnumber--
onPointerDownPointerEventHandler<Element>--
onPointerEnterPointerEventHandler<Element>--
onPointerLeavePointerEventHandler<Element>--
onPointerMovePointerEventHandler<Element>--
onPointerUpPointerEventHandler<Element>--
labelstring-
A concise label for the input, keep it below 40 characters. For a large form where only some options are required, add an asterisk (*) to the end of the label. If most fields in the form are required, add (optional) to the label.
disabledboolean-false
Disables the input. Use sparingly as it can be non-obvious to users why an input has been disabled. Prefer showing validation messages and hints instead.
autoFocusboolean-false
Gives the input focus on page load. Use sparingly as it can be confusing to screen-reader and mobile users.
readOnlyboolean-false
Makes the input read-only. Use sparingly, it's often preferred to present the data as regular text or in a table instead.
formstring--
Id of a form element that this input should be associated with. Defaults to the containing form element.
hintReactNode--
Additional hint or description.
enterKeyHint"done" | "go" | "next" | "previous" | "search" ...--
Hint the browser about what label to show for the Enter button on mobile keyboards.
requiredboolean-false
Makes the input required.
aria-describedbystring--
aria-labelledbystring--
onInvalidFormEventHandler<HTMLInputElement>--
Fires if the input fails validation on form submit.
onFocusFocusEventHandler<HTMLInputElement>--
onBlurFocusEventHandler<HTMLInputElement>--
onKeyDownKeyboardEventHandler<HTMLInputElement>--
onKeyUpKeyboardEventHandler<HTMLInputElement>--
PropTypeRequiredDefault
titlestring--
hiddenboolean--
idstring--
dirstring--
langstring--
slotstring--
translate"yes" | "no"--
classNamestring--
styleCSSProperties--
tabIndexnumber--
onPointerDownPointerEventHandler<Element>--
onPointerEnterPointerEventHandler<Element>--
onPointerLeavePointerEventHandler<Element>--
onPointerMovePointerEventHandler<Element>--
onPointerUpPointerEventHandler<Element>--
namestring-
The name of the input to use when submitting the form.
disabledboolean-false
Disables the input. Use sparingly as it can be non-obvious to users why an input has been disabled. Prefer showing validation messages and hints instead.
requiredboolean-false
Makes the input required.
onInvalidFormEventHandler<HTMLInputElement>--
Fires if the input fails validation on form submit.
onFocusFocusEventHandler<HTMLInputElement>--
onBlurFocusEventHandler<HTMLInputElement>--
aria-describedbystring--
aria-invalidboolean-false
Force the input to be invalid.
aria-labelledbystring--
enterKeyHint"done" | "go" | "next" | "previous" | "search" ...--
Hint the browser about what label to show for the Enter button on mobile keyboards.
formstring--
Id of a form element that this input should be associated with. Defaults to the containing form element.
readOnlyboolean-false
Makes the input read-only. Use sparingly, it's often preferred to present the data as regular text or in a table instead.
labelstring-
A concise label for the input, keep it below 40 characters. For a large form where only some options are required, add an asterisk (*) to the end of the label. If most fields in the form are required, add (optional) to the label.
errorMessagestring--
Set the error message of an input and mark it invalid.
autoFocusboolean-false
Gives the input focus on page load. Use sparingly as it can be confusing to screen-reader and mobile users.
hintReactNode--
Additional hint or description.
onKeyDownKeyboardEventHandler<HTMLInputElement>--
onKeyUpKeyboardEventHandler<HTMLInputElement>--
placeholderstring--
Placeholder text to show in the input when it is empty.
currencystring-
The currency to display.
currencyDisplay"symbol" | "code"-symbol
How to display the currency. "symbol" uses a localized currency symbol such as € or kr if appropriate for the locale. "code" always uses the ISO currency code.
align"start" | "end"--
Aligns the input content.
sizenumber--
Specifies the visible width, in characters, of the input.
valuestring | number--
Value of the input. Makes the input controlled.
defaultValuestring | number--
Default value of an uncontrolled input.
onChangeChangeEventHandler<HTMLInputElement, Element>--
Fires immediately when the input’s value is changed by the user (for example, it fires on every keystroke).
liststring--
Id of a `<datalist>` element with a list of predefined values to suggest to the user.
inputMode"text" | "numeric" | "decimal"-numeric
Hint the browser about the appropriate virtual keyboard for the type of expected data. Use `text` if you need support for negative numbers as the minus sign is not available on iPhone keyboards.
PropTypeRequiredDefault
titlestring--
hiddenboolean--
idstring--
dirstring--
langstring--
slotstring--
translate"yes" | "no"--
classNamestring--
styleCSSProperties--
tabIndexnumber--
onPointerDownPointerEventHandler<Element>--
onPointerEnterPointerEventHandler<Element>--
onPointerLeavePointerEventHandler<Element>--
onPointerMovePointerEventHandler<Element>--
onPointerUpPointerEventHandler<Element>--
namestring-
The name of the input to use when submitting the form.
disabledboolean-false
Disables the input. Use sparingly as it can be non-obvious to users why an input has been disabled. Prefer showing validation messages and hints instead.
requiredboolean-false
Makes the input required.
onInvalidFormEventHandler<HTMLInputElement>--
Fires if the input fails validation on form submit.
onFocusFocusEventHandler<HTMLInputElement>--
onBlurFocusEventHandler<HTMLInputElement>--
aria-describedbystring--
aria-invalidboolean-false
Force the input to be invalid.
aria-labelledbystring--
enterKeyHint"done" | "go" | "next" | "previous" | "search" ...--
Hint the browser about what label to show for the Enter button on mobile keyboards.
formstring--
Id of a form element that this input should be associated with. Defaults to the containing form element.
readOnlyboolean-false
Makes the input read-only. Use sparingly, it's often preferred to present the data as regular text or in a table instead.
labelstring-
A concise label for the input, keep it below 40 characters. For a large form where only some options are required, add an asterisk (*) to the end of the label. If most fields in the form are required, add (optional) to the label.
errorMessagestring--
Set the error message of an input and mark it invalid.
autoFocusboolean-false
Gives the input focus on page load. Use sparingly as it can be confusing to screen-reader and mobile users.
hintReactNode--
Additional hint or description.
onKeyDownKeyboardEventHandler<HTMLInputElement>--
onKeyUpKeyboardEventHandler<HTMLInputElement>--
placeholderstring--
Placeholder text to show in the input when it is empty.
unit"bit" | "byte" | "celsius" | "centimeter" | "da...-
unitDisplay"short" | "long"-short
How to display the unit.
align"start" | "end"--
Aligns the input content.
sizenumber--
Specifies the visible width, in characters, of the input.
valuestring | number--
Value of the input. Makes the input controlled.
defaultValuestring | number--
Default value of an uncontrolled input as a locale formatted string.
onChangeChangeEventHandler<HTMLInputElement, Element>--
Fires immediately when the input’s value is changed by the user (for example, it fires on every keystroke).
liststring--
Id of a `<datalist>` element with a list of predefined values to suggest to the user.
inputMode"text" | "numeric" | "decimal"-numeric
Hint the browser about the appropriate virtual keyboard for the type of expected data. Use `text` if you need support for negative numbers as the minus sign is not available on iPhone keyboards.
PropTypeRequiredDefault
variant"top-label" | "floating-label"-top-label
namestring-
The name of the textarea to use when submitting the form.
placeholderstring--
Placeholder text to show in the textarea when it is empty.
minLengthnumber--
Minimum length of the textarea value.
maxLengthnumber--
Maximum length of the textarea value.
rowsnumber-2
The number of visible text lines to show in the textarea.
autoCapitalize"none" | "sentences" | "words" | "characters"--
Controls whether and how text input is automatically capitalized as it is entered by the user.
spellCheckboolean--
Controls whether the element may be checked for spelling errors.
autoComplete"off" | "on"--
Enable or disable autocomplete in the textarea.
errorMessagestring--
Set the error message of a textarea and mark it invalid.
aria-invalidboolean-false
Force the textarea to be invalid.
defaultValuestring--
Default value of an uncontrolled textarea.
valuestring--
Value of the textarea. Makes the textarea controlled.
onChangeChangeEventHandler<HTMLTextAreaElement, Element>--
Fires immediately when the textarea's value is changed by the user (for example, it fires on every keystroke).
hiddenboolean--
idstring--
titlestring--
dirstring--
langstring--
slotstring--
translate"yes" | "no"--
classNamestring--
styleCSSProperties--
tabIndexnumber--
onPointerDownPointerEventHandler<Element>--
onPointerEnterPointerEventHandler<Element>--
onPointerLeavePointerEventHandler<Element>--
onPointerMovePointerEventHandler<Element>--
onPointerUpPointerEventHandler<Element>--
labelstring-
A concise label for the input, keep it below 40 characters. For a large form where only some options are required, add an asterisk (*) to the end of the label. If most fields in the form are required, add (optional) to the label.
disabledboolean-false
Disables the input. Use sparingly as it can be non-obvious to users why an input has been disabled. Prefer showing validation messages and hints instead.
autoFocusboolean-false
Gives the input focus on page load. Use sparingly as it can be confusing to screen-reader and mobile users.
readOnlyboolean-false
Makes the input read-only. Use sparingly, it's often preferred to present the data as regular text or in a table instead.
formstring--
Id of a form element that this input should be associated with. Defaults to the containing form element.
hintReactNode--
Additional hint or description.
enterKeyHint"done" | "go" | "next" | "previous" | "search" ...--
Hint the browser about what label to show for the Enter button on mobile keyboards.
requiredboolean-false
Makes the input required.
aria-describedbystring--
aria-labelledbystring--
onInvalidFormEventHandler<HTMLTextAreaElement>--
Fires if the input fails validation on form submit.
onFocusFocusEventHandler<HTMLTextAreaElement>--
onBlurFocusEventHandler<HTMLTextAreaElement>--
onKeyDownKeyboardEventHandler<HTMLTextAreaElement>--
onKeyUpKeyboardEventHandler<HTMLTextAreaElement>--