An input field that restricts user input to a mask pattern and formats the visible value.

Slots
prefix — Renders content before the input.
suffix — Renders content after the input.
helper-text — Renders content below the input.
value-missing — Renders content when the required validation fails.
bad-input — Renders content when the value does not fill the required positions of the mask.
custom-error — Renders content when a custom message is set with `setCustomValidity()`.
invalid — Renders content when the component is in invalid state (validity.valid = false).
CSS Parts
container — The main wrapper that holds all main input elements.
input — The native input element.
label — The native label element.
prefix — The prefix wrapper.
suffix — The suffix wrapper.
helper-text — The helper text wrapper.
prefixed — Added to the container and the input when an element that is not hidden is in the prefix slot.
suffixed — Added to the container and the input when an element that is not hidden is in the suffix slot.
filled — Added to the container and the input when the control has a value.
labelled — Added to the container in the material theme when the control has a label.
start — The wrapper of the prefix in the material theme.
notch — The wrapper of the label in the material theme.
filler — The outline segment between the notch and the end in the material theme.
end — The wrapper of the suffix in the material theme.

The label for the control.

label: string

The mask pattern of the control.

mask: string

Whether the control has an outlined appearance.

outlined: boolean

The placeholder text of the control.

placeholder: string

The prompt symbol to use for unfilled parts of the mask pattern.

prompt: string

The value of the control. Its format depends on valueMode.

An empty value is always an empty string, regardless of the value mode.

value: string

The format of the value and of the submitted form value:

  • raw: The input without the mask literals and prompts (e.g. "5551234567")
  • withFormatting: The input with the mask formatting (e.g. "(555) 123-4567")

An empty value is always an empty string, regardless of the value mode.

valueMode: MaskInputValueMode

Removes focus from the control.

blur(): void

Returns void

Sets focus on the control.

focus(options: FocusOptions): void

Parameters

  • options: FocusOptions

Returns void

Returns whether the current masked input is valid according to the mask pattern. An empty control is valid. The required validator checks it.

isValidMaskPattern(): boolean

Returns boolean

Selects all the text inside the input.

select(): void

Returns void

Emitted when the user commits a change to the value of the control.

onChange(args: CustomEvent<string>): void

Parameters

Returns void

Emitted when the control receives user input.

onInput(args: CustomEvent<string>): void

Parameters

Returns void