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

IgcMaskInputComponent

new IgcMaskInputComponent(args: any[]): IgcMaskInputComponent

Defined in src/components/common/mixins/constructor.ts:3

Returns IgcMaskInputComponent

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

The disabled state of the component.

disabled: boolean

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

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

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

invalid: boolean

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

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

The label for the control.

label: string

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

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

The name attribute of the control.

name: string

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

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

Whether the control will have outlined appearance.

outlined: boolean = false

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

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

The placeholder attribute of the control.

placeholder: string

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

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

Makes the control a readonly field.

readOnly: boolean

Defined in src/components/common/mixins/mask-behavior.ts:53

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:109

The tagName read-only property of the Element interface returns the tag name of the element on which it's called.

MDN Reference

tagName: "igc-mask-input" = 'igc-mask-input'

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

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

get defaultValue(): unknown

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

Returns unknown

The initial value of the component.

set defaultValue(value: unknown): void

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

Parameters

  • value: unknown

Returns void

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

Returns the HTMLFormElement associated with this element.

get form(): HTMLFormElement | null

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

Returns HTMLFormElement | null

The mask pattern of the component.

get mask(): string

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

Returns string

The masked pattern of the component.

set mask(value: string): void

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

Parameters

  • value: string

Returns void

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

get prompt(): string

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

Returns string

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

set prompt(value: string): void

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

Parameters

  • value: string

Returns void

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

get required(): boolean

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

Returns boolean

When set, makes the component a required field for validation.

set required(value: boolean): void

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

Parameters

  • value: boolean

Returns void

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

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: MaskBehaviorMixin( IgcInputBaseComponent )

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

The value attribute of the control.

get value(): string

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

Returns string

The value of the input.

Regardless of the currently set value-mode, an empty value will return an empty string.

set value(string: string): void

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

Parameters

  • string: string

Returns void

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

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: MaskBehaviorMixin( IgcInputBaseComponent )

addEventListener(type: K, listener: object, options: boolean | AddEventListenerOptions): void

Defined in src/components/common/mixins/event-emitter.ts:7

Parameters

  • type: K
  • listener: object
  • options: boolean | AddEventListenerOptions

Returns void

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

Removes focus from the control.

blur(): void

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

Returns void

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

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:146

Returns boolean

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

emitEvent(type: K, eventInitDict: CustomEventInit<D>): boolean

Defined in src/components/common/mixins/event-emitter.ts:30

Parameters

  • type: K
  • eventInitDict: CustomEventInit<D>

Returns boolean

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

Sets focus on the control.

focus(options: FocusOptions): void

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

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:261

Returns boolean

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

removeEventListener(type: K, listener: object, options: boolean | EventListenerOptions): void

Defined in src/components/common/mixins/event-emitter.ts:17

Parameters

  • type: K
  • listener: object
  • options: boolean | EventListenerOptions

Returns void

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

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:149

Returns boolean

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

Selects all the text inside the input.

select(): void

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

Returns void

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

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:155

Parameters

  • message: string

Returns void

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

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/common/mixins/mask-behavior.ts:94

Parameters

Returns void

Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )

Sets the text selection range of the control.

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

Defined in src/components/common/mixins/mask-behavior.ts:87

Parameters

Returns void

register(): void

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

Returns void