Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

MaskedInput

Guide entry of formatted delivery information.

Preview

Live preview

Changes apply to this preview only.

Delivery contact

MaskedInput is controlled here and writes into the same form state as the regular inputs.

We only call on delivery day.

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Patterns

The same engine covers phone numbers, dates, postal codes and mixed alphanumeric references.

Open preview

Sizes

sm, md and lg match the other text controls.

Open preview

Controlled value and paste

onValueChange receives the formatted string. Pasting a formatted value is normalized and the caret lands after the last accepted character.

Open preview

Usage

Separate display formatting from the value your backend expects and validate the complete input.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluMaskedInputProps

Type source
PimoluMaskedInputProps public API
NameTypeDefaultDescription
maskRequiredstring—Mask pattern. `9` accepts a digit, `a` a letter, `*` a letter or a digit. Every other character is a literal, `\` escapes a token.
valuestring | undefined—Controlled **formatted** value.
defaultValuestring | undefined—Initial value, formatted with the mask.
onValueChange((value: string) => void) | undefined—Called with the next formatted value.
labelReactNode—Visible label, associated with the text input.
helperTextReactNode—Supporting text below the field.
errorMessageReactNode—Error text, replacing the helper text.
invalidboolean | undefinedfalseInvalid state without an error message.
sizePimoluMaskedInputSize | undefined"md"Visual size. Defaults to "md".
fullWidthboolean | undefinedfalseStretch to the parent width.
containerClassNamestring | undefined—Class applied to the outer field.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLInputElement> | undefined—Standard React/HTML attribute.
disabledboolean | undefinedfalseStandard React/HTML attribute.
namestring | undefined—Standard React/HTML attribute.
requiredboolean | undefinedfalseStandard React/HTML attribute.
maskRequired

string

No default extracted.

Mask pattern. `9` accepts a digit, `a` a letter, `*` a letter or a digit. Every other character is a literal, `\` escapes a token.

value

string | undefined

No default extracted.

Controlled **formatted** value.

defaultValue

string | undefined

No default extracted.

Initial value, formatted with the mask.

onValueChange

((value: string) => void) | undefined

No default extracted.

Called with the next formatted value.

label

ReactNode

No default extracted.

Visible label, associated with the text input.

helperText

ReactNode

No default extracted.

Supporting text below the field.

errorMessage

ReactNode

No default extracted.

Error text, replacing the helper text.

invalid

boolean | undefined

Default: false

Invalid state without an error message.

size

PimoluMaskedInputSize | undefined

Default: "md"

Visual size. Defaults to "md".

fullWidth

boolean | undefined

Default: false

Stretch to the parent width.

containerClassName

string | undefined

No default extracted.

Class applied to the outer field.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLInputElement> | undefined

No default extracted.

Standard React/HTML attribute.

disabled

boolean | undefined

Default: false

Standard React/HTML attribute.

name

string | undefined

No default extracted.

Standard React/HTML attribute.

required

boolean | undefined

Default: false

Standard React/HTML attribute.

Accessibility

  • Explain the expected format outside the placeholder and allow paste and correction.
Read the accessibility guide →