Skip to content

TextInput

Props

API reference for TextInput. For usage examples, see the React tab.

TextInput

NameTypeDefault
alignment"left" | "right"left

Sets the alignment of the value in the input

childrenChildrenOrFunction<TextFieldRenderProps>

The children of the component. A function may be provided to alter the children based on component state.

descriptionstring

Adds a description to the input

hasCharacterCountbooleanfalse

Shows the character counter when using the maxLength prop

inputMode"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url"

Hints at the type of data that might be entered by the user while editing the element or its contents. See MDN (opens in new tab).

isDisabledboolean

Whether the input is disabled.

isInvalidboolean

Whether the value is invalid.

isReadOnlyboolean

Whether the input can be selected but not changed by the user.

isRequiredboolean

Whether user input is required on the input before form submission.

labelstring

Adds a label to the input

size"lg" | "md" | "sm""md"

Controls height, padding, and typography of the input.

compactDeprecatedboolean

Renders the compact variant of the input

Use size instead. This prop is a no-op.

TextField

NameTypeDefault
childrenChildrenOrFunction<TextFieldRenderProps>

The children of the component. A function may be provided to alter the children based on component state.

inputMode"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url"

Hints at the type of data that might be entered by the user while editing the element or its contents. See MDN (opens in new tab).

isDisabledboolean

Whether the input is disabled.

isInvalidboolean

Whether the value is invalid.

isReadOnlyboolean

Whether the input can be selected but not changed by the user.

isRequiredboolean

Whether user input is required on the input before form submission.