/

Plugins

Plugins are functions that are called with input/textarea element and mask options as arguments upon mask initialization. They can optionally return cleanup logic and allow you to extend mask with arbitrary additional behavior.

Visualize rejected characters

#
This plugin is available as maskitoRejectEvent in @maskito/kit

Built-in initial calibration plugin

#

Maskito libraries were created to prevent only user from typing invalid value. However, sometimes you (developer) need to enable mask but you not sure that you programmatically patched textfield with valid value. In this case you can use maskitoTransform or just add maskitoInitialCalibrationPlugin to mask options.

Built-in plugin for composition event

#

By default, Maskito does not break IME Composition and waits until compositionend fires to begin calibration of the textfield's value. It is especially important for East Asian languages such as Chinese, Japanese, Korean, and other languages with complex characters.

However, sometimes this behaviour is not desired and you can want to enable mask validation on every keystroke (to be like a classic not-composition input). For example, some Android devices with enabled system autocomplete can interpret user's input as part of composition event – waiting for compositionend can be not required for some cases (e.g. entering of numbers or your application is not used by East Asian clients). For this cases, you can use maskitoStrictCompositionPlugin . It applies mask's constraints on ANY intermediate value of IME composition.

Built-in plugin for change event

#

Native beforeinput event default behavior is cancelled to process user entered invalid value. This causes native change event to NOT be dispatched by browser. A change event, as opposed to input , is triggered only when user left the field and value was changed during interaction. If you rely on this behavior, add maskitoChangeEventPlugin to your mask configuration. It will dispatch synthetic change event using the same logic.

Next steps

The following sections are recommended to explore core concepts further: