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>
component props. Because of this, you can use all of the native props. This is a required children.
Control API
Notice that there is a difference between using hasError, isDisabled, isReadOnly
here or in the parent component. It is not recommended to change this props in the Control
subcomponent, because this props can be inherited from the Wrapper
. If you use it in the Control
subcomponent, you will get the state only in the field.
defaultValue
string | number | readonly string[] | undefined;
hasError
boolean
isDisabled
boolean
isReadOnly
boolean
prefix
string
sufix
string
maxLength
number
lettersOnly
boolean
alphanumericOnly
boolean
icon
hasClearAction
boolean
clearActionVisibility
'auto' | 'always'
customFilter
(value: string) => string;
onChange
(e: React.ChangeEvent<HTMLInputElement>) => void;
onClean
() => void;
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.
children
ReactNode
✅
Label
The Label subcomponent extends the SDS label component. See for reference: Label
Last updated