A masked input is an input field where a developer can control user input and format the visible value, based on configurable rules

Element
igc-mask-input
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 a required mask pattern validation fails.
custom-error — Renders content when setCustomValidity(message) is set.
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

Inherited from: IgcMaskInputBaseComponent

The disabled state of the component.

disabled: boolean

Defined in src/components/common/mixins/forms/types.ts:29

Inherited from: IgcMaskInputBaseComponent

Sets the control into invalid state (visual state only).

invalid: boolean

Defined in src/components/common/mixins/forms/types.ts:36

Inherited from: IgcMaskInputBaseComponent

The label for the control.

label: string

Defined in src/components/input/input-base.ts:70

Inherited from: IgcMaskInputBaseComponent

The name attribute of the control.

name: string

Defined in src/components/common/mixins/forms/types.ts:42

Inherited from: IgcMaskInputBaseComponent

Whether the control will have outlined appearance.

outlined: boolean = false

Defined in src/components/input/input-base.ts:56

Inherited from: IgcMaskInputBaseComponent

The placeholder attribute of the control.

placeholder: string

Defined in src/components/input/input-base.ts:63

Inherited from: IgcMaskInputBaseComponent

Makes the control a readonly field.

readOnly: boolean = false

Defined in src/components/mask-input/mask-input-base.ts:50

Dictates the behavior when retrieving the value of the control:

  • raw: Returns clean input (e.g. "5551234567")
  • withFormatting: Returns with mask formatting (e.g. "(555) 123-4567")

Empty values always return an empty string, regardless of the value mode.

valueMode: MaskInputValueMode = 'raw'

Defined in src/components/mask-input/mask-input.ts:104

mask: string

Defined in src/components/mask-input/mask-input.ts:138, src/components/mask-input/mask-input.ts:145

prompt: string

Defined in src/components/mask-input/mask-input.ts:156, src/components/mask-input/mask-input.ts:163

value: string

Defined in src/components/mask-input/mask-input.ts:115, src/components/mask-input/mask-input.ts:122

Inherited from: IgcMaskInputBaseComponent

Returns the HTMLFormElement associated with this element.

get form(): HTMLFormElement | null

Defined in src/components/common/mixins/forms/types.ts:45

Returns HTMLFormElement | null

Inherited from: IgcMaskInputBaseComponent

A string containing the validation message of this element.

get validationMessage(): string

Defined in src/components/common/mixins/forms/types.ts:54

Returns string

Inherited from: IgcMaskInputBaseComponent

Returns a ValidityState object which represents the different validity states the element can be in, with respect to constraint validation.

get validity(): ValidityState

Defined in src/components/common/mixins/forms/types.ts:51

Returns ValidityState

Inherited from: IgcMaskInputBaseComponent

A boolean value which returns true if the element is a submittable element that is a candidate for constraint validation.

get willValidate(): boolean

Defined in src/components/common/mixins/forms/types.ts:60

Returns boolean

Inherited from: IgcMaskInputBaseComponent

Removes focus from the control.

blur(): void

Defined in src/components/input/input-base.ts:102

Returns void

Inherited from: IgcMaskInputBaseComponent

Checks for validity of the control and emits the invalid event if it invalid.

checkValidity(): boolean

Defined in src/components/common/mixins/forms/types.ts:140

Returns boolean

Inherited from: IgcMaskInputBaseComponent

Sets focus on the control.

focus(options: FocusOptions): void

Defined in src/components/input/input-base.ts:96

Parameters

  • options: FocusOptions

Returns void

Returns whether the current masked input is valid according to the mask pattern.

isValidMaskPattern(): boolean

Defined in src/components/mask-input/mask-input.ts:256

Returns boolean

Inherited from: IgcMaskInputBaseComponent

Checks for validity of the control and shows the browser message if it invalid.

reportValidity(): boolean

Defined in src/components/common/mixins/forms/types.ts:143

Returns boolean

Inherited from: IgcMaskInputBaseComponent

Selects all the text inside the input.

select(): void

Defined in src/components/input/input-base.ts:90

Returns void

Inherited from: IgcMaskInputBaseComponent

Sets a custom validation message for the control. As long as message is not empty, the control is considered invalid.

setCustomValidity(message: string): void

Defined in src/components/common/mixins/forms/types.ts:149

Parameters

  • message: string

Returns void

Inherited from: IgcMaskInputBaseComponent

Replaces the selected text in the control and re-applies the mask

setRangeText(replacement: string, start: number, end: number, selectMode: RangeTextSelectMode): void

Defined in src/components/mask-input/mask-input-base.ts:198

Parameters

  • replacement: string
  • start: number
  • end: number
  • selectMode: RangeTextSelectMode

Returns void

Inherited from: IgcMaskInputBaseComponent

Sets the text selection range of the control

setSelectionRange(start: number, end: number, direction: SelectionRangeDirection): void

Defined in src/components/mask-input/mask-input-base.ts:187

Parameters

  • start: number
  • end: number
  • direction: SelectionRangeDirection

Returns void