Skip to main content

Masked Input

Conforms user input to a pre-defined pattern.

Examples

Basic Masked Input

Providing a mask prop will guide the user in their entry. Simple regex patterns define allowed values.

<MaskedInput
label="SSN"
mask={[/[1-9]/, /d/, /d/, '-', /d/, /d/, '-', /d/, /d/, /d/, /d/]}
placeholder="123-45-6789"
/>

Props

NameTypeDefault ValueRequiredDescription
fieldClassNamestringNoA className to apply to the field.
fieldPropsRecord<string, unknown>NoAny props to spread onto the field container.
helperTextReactNodeNoA string or component to display as helper text beneath the input
iconEndstring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal | nullNoAn icon to render at the end of the input.
iconStartstring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal | nullNoAn icon to render at the front of the input.
labelReactNodeNoA string or component to display as a label above the input
multilinebooleanfalseNoShould a textarea be used instead of an input?
onChangeFormControlChangeEventHandler<InputType, string | number | readonly string[] | (string | number | readonly string[])[]> | undefinedNoEmit a new value when the input's selected value changes.
requiredbooleanfalseNoIs the field required?
resizebooleanfalseNoCan the textarea be resized?
rowsstring | numberNoHow many rows call should the multiline input be?
sizeundefinedFormControlSize.MediumNoThe size of the field
state"" | FormControlState | "critical" | "warning" | "success"FormControlState.DefaultNoThe state of the field