InputMask
Pattern-masked input (# A *)
For values with one fixed shape — a domestic phone number, a card number, a postcode, a product code. The literals appear as you type, anything that doesn't fit the next slot is dropped, and a paste is reformatted. For values whose length or shape varies (international phone numbers, emails), use Input with pattern instead: a mask that is wrong for someone's value locks them out.
Basic
masked: — · raw: —
- Tokens:
#a digit,Aa letter,*either. Anything else is a literal. v-modelis the masked value (090-1234-5678), and that is what the form submits.@update:rawgives it with the literals stripped (09012345678).- A mask with only
#tokens setsinputmode="numeric", so phones show the number pad; passinputmodeto override. - The placeholder defaults to the mask with
_in each slot.
Usage
ts
import { BlessInputMask } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
mask* | string | — | # digit · A letter · * letter or digit · anything else is a literal |
placeholder | string | — | placeholder shown when empty; defaults to the mask with tokens as _ |
modelValue | string | "" | the formatted value, e.g. "090-1234-5678" |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: string] | |
update:raw | [raw: string] |