Mask Controller is a Stimulus controller for applying a mask to a string in an element.
These are standard HTML attributes (with no prefix) used by the controller.
All of these attributes are prefixed with "data-" in the attribute name.
| Attribute | Element(s) | Default | Value(s) | Description |
|---|---|---|---|---|
| controller |
(any) |
mask | This attribute provides the controller functionality. |
All of these attributes are prefixed with "data-mask-" in the attribute name.
| Attribute | Element(s) | Default | Value(s) | Description |
|---|---|---|---|---|
| format |
(root) |
(string) | The format to apply to the string. See the imask patterns page for more details. |
| Event | Parameters | Description |
|---|---|---|
| connected | Called any time that the controller is connected. | |
| disconnected | Called any time that the controller is disconnected. | |
| applied | Called any time that the controller applies a format. |
While it is recommended to use the controller via the attributes listed above, the following methods can be called directly if needed.
| Method | Returns | Arguments | Event(s) | Description |
|---|---|---|---|---|
| getFormat | (string) |
Get the format used by this element. |