Form
InputMask
A text box that types into a pattern, such as a phone or a date, filling in the literals for you.
WAI-ARIA tested
Import
main.ts
import { InputMask } from '@vitral/vue';Basic
Value: —
Unmasked value
v-model: —
Slot characters and optional parts
Sizes and states
API
Read from packages/vue/src/components/InputMask/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| mask * | string | The pattern: `9` takes a digit, `a` a letter, `*` either; anything after `?` is optional; every other character is typed for the reader. |
| slotChar | string | What an empty slot shows: one character, or a string as long as the mask (`'mm/dd/yyyy'`). Defaults to `_`. |
| autoClear | boolean | Clear an unfinished value when the box loses focus. Defaults to true. |
| unmask | boolean | v-model receives only the typed characters, without the literals. |
| definitions | Record<string, RegExp> | Extra slot characters, each with the characters it accepts. |
| size | Size | — |
| variant | InputVariant | Defaults to the plugin's `inputVariant`. |
| invalid | boolean | — |
| disabled | boolean | — |
| readonly | boolean | — |
| fluid | boolean | — |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Emits
| Event | Payload | Description |
|---|---|---|
| complete | event: { originalEvent: Event; value: string } | Every required slot is filled. |
| focus | event: FocusEvent | — |
| blur | event: FocusEvent | — |