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
Constructors
Section titled "Constructors"IgcMaskInputComponent
new IgcMaskInputComponent(args: any[]): IgcMaskInputComponent Defined in src/components/common/mixins/constructor.ts:3
Returns IgcMaskInputComponent
Properties
Section titled "Properties"disabled
Section titled "disabled"Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )
The disabled state of the component.
disabled: boolean invalid
Section titled "invalid"Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )
Sets the control into invalid state (visual state only).
invalid: boolean label
Section titled "label"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 outlined
Section titled "outlined"Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )
Whether the control will have outlined appearance.
outlined: boolean = false Defined in src/components/input/input-base.ts:54
placeholder
Section titled "placeholder"Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )
The placeholder attribute of the control.
placeholder: string Defined in src/components/input/input-base.ts:61
readOnly
Section titled "readOnly"Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )
Makes the control a readonly field.
readOnly: boolean valueMode
Section titled "valueMode"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
styles
Section titled "styles"styles: CSSResult[] Defined in src/components/mask-input/mask-input.ts:61
tagName
Section titled "tagName"The tagName read-only property of the Element interface returns the tag name of the element on which it's called.
tagName: "igc-mask-input" = 'igc-mask-input' Defined in src/components/mask-input/mask-input.ts:60
Accessors
Section titled "Accessors"defaultValue
Section titled "defaultValue"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
prompt
Section titled "prompt"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
required
Section titled "required"Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )
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
validationMessage
Section titled "validationMessage"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
validity
Section titled "validity"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
value
Section titled "value"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
willValidate
Section titled "willValidate"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
Methods
Section titled "Methods"addEventListener
Section titled "addEventListener"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
checkValidity
Section titled "checkValidity"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
emitEvent
Section titled "emitEvent"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
focus
Section titled "focus"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
isValidMaskPattern
Section titled "isValidMaskPattern"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
removeEventListener
Section titled "removeEventListener"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
reportValidity
Section titled "reportValidity"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
select
Section titled "select"Inherited from: MaskBehaviorMixin( IgcInputBaseComponent )
Selects all the text inside the input.
select(): void Defined in src/components/input/input-base.ts:88
Returns void
setCustomValidity
Section titled "setCustomValidity"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
setRangeText
Section titled "setRangeText"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
- replacement:
string - start:
number - end:
number - selectMode:
RangeTextSelectMode
Returns void
setSelectionRange
Section titled "setSelectionRange"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
- start:
number - end:
number - direction:
SelectionRangeDirection
Returns void
register
Section titled "register"register(): void Defined in src/components/mask-input/mask-input.ts:64