Repolode
beholdr

beholdr/maska

Zero-dependency input mask library for Vue, Svelte, Alpine.js and vanilla JavaScript, about 3 KB gzipped.

Stars
2,021
Forks
78
Open issues
6
Last commit
23 days ago

What is it?

Maska formats text inputs as users type, applying patterns such as phone numbers, dates or card numbers. It has no runtime dependencies and ships as a small library usable from plain JavaScript or through integrations for Vue 2/3, Alpine.js and Svelte.

Masks can be built from custom tokens with modifiers, transform functions and hooks. It supports dynamic masks, reversed masks and eager masks that display the fixed characters before the user types. It works with both native inputs and custom input components.

A number mask mode covers money-style formatting. Version 3 added the Alpine.js and Svelte integrations, the number mask mode and a simplified directive format.

Key features

  • 01Zero dependencies with a gzipped size around 3 KB
  • 02Integrations for Vue 2/3, Alpine.js and Svelte, plus vanilla JS
  • 03Works with native and custom input components
  • 04Custom tokens with modifiers, transform functions and hooks
  • 05Number mask mode for money formatting
  • 06Dynamic, reversed and eager masks

Use cases

  • Formatting phone numbers or dates in a Vue form
  • Adding money-style number formatting to a checkout input
  • Applying fixed-format masks in an Alpine.js or Svelte app without extra dependencies

Topics

FAQ

What is maska?
Zero-dependency input mask library for Vue, Svelte, Alpine.js and vanilla JavaScript, about 3 KB gzipped. Maska formats text inputs as users type, applying patterns such as phone numbers, dates or card numbers. It has no runtime dependencies and ships as a small library usable from plain JavaScript or through integrations for Vue 2/3, Alpine.js and Svelte.
Is maska free to use? What license does it have?
maska is open source under the MIT license. Check the license terms before using it in commercial products.
Is maska still maintained?
Actively maintained. The last commit to maska was on Sep 29, 2026.
What can I use maska for?
Formatting phone numbers or dates in a Vue form Adding money-style number formatting to a checkout input Applying fixed-format masks in an Alpine.js or Svelte app without extra dependencies
Where can I get maska?
The source code and installation instructions are on GitHub: https://github.com/beholdr/maska

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects