Subcomponents

This component has 3 subcomponents:

Control

The control subcomponent is required to render the Control of the TextInput component. Because of this, this component extends the native <input>arrow-up-right component props. Because of this, you can use all of the native props. This is a required children.

Control API

triangle-exclamation
Props
Type
Required

defaultValue

string | number | readonly string[] | undefined;

❌

hasError

boolean

❌

isDisabled

boolean

❌

isReadOnly

boolean

❌

prefix

string

❌

sufix

string

❌

maxLength

number

❌

lettersOnly

boolean

❌

alphanumericOnly

boolean

❌

hasClearAction

boolean

❌

clearActionVisibility

'auto' | 'always'

❌

customFilter

(value: string) => string;

❌

onChange

(e: React.ChangeEvent<HTMLInputElement>) => void;

❌

onClean

() => void;

❌

chevron-rightvaluehashtag

The value of the TextInput when using a controlled approach.

chevron-rightdefaultValuehashtag

This sets a default value for the input when the DOM is rendered. This should be used when having an uncontrolled approach.

chevron-rightprefixhashtag

Adds extra information on the left side of the Input. Usually value unities.

chevron-rightsufixhashtag

Adds extra information on the right side of the Input. Usually value unities.

chevron-righticonhashtag

To render a custom icon in the TextInput.

chevron-righthasClearActionhashtag

To render an 'x' icon, that if, uncontrolled, will clean the input.

chevron-rightclearActionVisibilityhashtag

The behavior to show the 'x' icon in the input.

chevron-rightonCleanhashtag

Function executed when the 'x' button is clicked.

chevron-rightmaxLengthhashtag

Indicates a max length value to write in the input component

chevron-rightcustomFilterhashtag

Function where developers can create their own filters

HelpText

The helptext subcomponent renders the children passed below the field as a string. This is made like this so you can have full control over the component.

Helptext API

The control subcomponent is required to render the HelpText of the TextInput component. Because of this, this component extends the native span component props.

Props
Type
Required

children

ReactNode

βœ…

Label

The Label subcomponent extends the SDS label component. See for reference: Label

Last updated