Founding price: $35, then $79.99 after 23:59 UTC on 4 November, then $79.99
Get ProAn input that formats as you type with a pattern such as (999) 999-9999: it keeps the caret in the right place, handles paste and Backspace over punctuation, returns the raw value, and reports when the mask is complete.
This item has no props to tune. Use the lens above to change theme, density, direction and more.
Mask tokens: 9 digit, a letter, * letter or digit; any other character is shown as it is, and \ escapes a token. A mask formats; it does not validate that a date exists or a card number passes the Luhn check, so validate the raw value too.
| Export | Description |
|---|---|
MaskedInput | The input. |
MASKS | Ready masks: US phone, date, time, card, ZIP, ZIP+4, SSN, UK postcode, IBAN. |
applyMask(text, mask, uppercase?) | { masked, raw, complete }. |
unmask(text, mask), maskPlaceholder(mask), parseMask(mask) | Helpers. |
| Prop | Type | Default | Description |
|---|---|---|---|
mask | string | - | The pattern. |
value | string | - | The raw value. |
onValueChange | (raw, { masked, raw, complete }) => void | - | |
uppercase | boolean | false | Upper-case letters. |
showMaskPlaceholder | boolean | true | (___) ___-____ as the placeholder. |
All other props go to the input (id, name, autoComplete, aria-describedby, ...).
Label and a hint about the format, because a placeholder is not a label and disappears once typing starts.inputmode="numeric" is set when the mask is digits only, so touch keyboards show the number pad; autocomplete is passed through (cc-number, tel, postal-code).aria-describedby instead of relying on the pattern.The component ships with a Testing Library test (masked-input.test.tsx) that covers: its main behaviour, the keyboard path and the error or empty states.