Class IgcMaskInputComponent

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

igc-mask-input

prefix - Renders content before the input

suffix - Renders content after the input

helper-text - Renders content below the input

igcInput - Emitted when the control receives user input

igcChange - Emitted when an alteration of the control's value is committed by the user

igcFocus - Emitted when the control gains focus

igcBlur - Emitted when the control loses focus

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

Hierarchy

Hierarchy

  • IgcMaskInputBaseComponent
    • IgcMaskInputComponent

Other

disabled: boolean

The disabled state of the component

[disabled=false]

invalid: boolean

Control the validity of the control.

label: string

The label for the control.

name: string

The name attribute of the control.

outlined: boolean = false

Whether the control will have outlined appearance.

placeholder: string

The placeholder attribute of the control.

prompt: string

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

readOnly: boolean = false

Makes the control a readonly field.

readonly

required: boolean

Makes the control a required field in a form context.

size: "small" | "medium" | "large"

Determines the size of the component.

since v4.5.0. Use the --ig-size CSS custom property instead.

valueMode: "raw" | "withFormatting" = 'raw'

Dictates the behavior when retrieving the value of the control:

  • raw will return the clean user input.
  • withFormatting will return the value with all literals and prompts.

value-mode

  • set readonly(value): void
  • Makes the control a readonly field.

    since v4.4.0. Use the readOnly property instead.

    Parameters

    • value: boolean

    Returns void

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

    Returns ValidityState

  • get value(): string
  • The value of the input.

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

    Returns string

  • set value(string): void
  • The value attribute of the control.

    Parameters

    • string: string

    Returns void

  • get willValidate(): boolean
  • A boolean value which returns true if the element is a submittable element that is a candidate for constraint validation.

    Returns boolean

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

    Parameters

    • message: string

    Returns void

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

    Parameters

    • replacement: string
    • start: number
    • end: number
    • selectMode:
          | "end"
          | "start"
          | "select"
          | "preserve"

    Returns void

  • Sets the text selection range of the control

    Parameters

    • start: number
    • end: number
    • direction: "none" | "forward" | "backward"

    Returns void

lifecycle

  • Invoked when the component is removed from the document's DOM.

    This callback is the main signal to the element that it may no longer be used. disconnectedCallback() should ensure that nothing is holding a reference to the element (such as event listeners added to nodes external to the element), so that it is free to be garbage collected.

    disconnectedCallback() {
    super.disconnectedCallback();
    window.removeEventListener('keydown', this._handleKeydown);
    }

    An element may be re-connected after being disconnected.

    Returns void