Actions

Mask

Description

The Mask action can be used to create input masks, it will automatically format the input value based on the provided mask. This action is heavily inspired by the Alpine.js Mask plugin.

Usage

<script lang="ts">
    import { mask, type MaskParameters } from 'action-archive';

    const maskParameters: MaskParameters = {
        mask: '99/99/99'
    };
</script>

<input use:mask={maskParameters} />

Wildcards

Masks can be specified through 3 types of wild cards, any other character will be treated as a literal.

WildcardDescription
*Any character [a-z0-9]
9Any number [0-9]
aAny letter [a-z]

Example

API

Parameters

NameTypeDefaultDescription
maskstring-Mask that the input will adhere to.
disabledbooleanfalseDisables the action.