OSS TanbouSign in with GitHub

apply phone, number, date, and other input masks while separating displayed, unmasked, and typed values

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
5,182
Primary language
TypeScript
License
MIT
Repository last updated
Oct 11, 2024
On this page

Overview

IMask is a JavaScript/TypeScript library for applying input masks to input and contenteditable elements. It supports Pattern, Number, Date, RegExp, Dynamic, and other mask types while exposing displayed value, unmaskedValue, and typed typedValue forms.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Choose Pattern, Number, Date, and other mask types

The library supports pattern, regular-expression, numeric, date, function, dynamic, enum, range, and related masks, including optional sections and custom definitions.

Sources: [1]

Separate displayed, unmasked, and typed values

Input controls expose the formatted value, the formatting-free unmaskedValue, and a typed typedValue for cases such as numbers and dates, separating UI presentation from application data.

Sources: [2][1]

Use framework-specific plugins over the same masking engine

The monorepo includes integrations for Vue, Angular, React, React Native, Svelte, and Solid, allowing framework projects to reuse the same masking concepts as vanilla JavaScript.

Sources: [1]

Best fit

Fits phone, currency, date, and code fields that need input guidance

It works well when forms should format values during entry while submitting an unmasked string or typed number/date to application logic.

Sources: [1]

Before adoption

Input masks guide format but do not replace domain validation

A value matching the mask is not proof that a phone number exists or that a numeric value satisfies business constraints. Server-side validation and domain rules remain separate responsibilities.

Sources: [1]

Framework plugins should be checked against core and framework versions

React, Vue, and other wrappers live in the same monorepo, but applications should still verify peer-dependency compatibility with the selected framework version.

Sources: [1]

Official sources

  1. [1]IMask v7.6.1 README(2026-10-05)
  2. [2]IMask guide(2026-10-05)
  3. [3]IMask v7.6.1 package metadata(2026-10-05)
  4. [4]IMask v7.6.1 release(2026-10-05)
Supplemental curator note

IMask is useful when forms need formatted input for users while application logic consumes a separate unmasked or typed value. The monorepo also provides dedicated integrations for React, Vue, Angular, Svelte, and other frameworks.

Try it in 3 steps

  1. 1

    Install IMask 7.6.1

    Pin the reviewed stable release.

    npm install --save-exact imask@7.6.1
  2. 2

    Apply a numeric mask to an input

    Follow the documented import pattern and attach a number mask to the target input.

    import IMask from 'imask'; const input = document.querySelector('#amount'); const mask = IMask(input, { mask: Number, thousandsSeparator: ',' });
  3. 3

    Inspect displayed, unmasked, and typed values

    Compare the formatted value, formatting-free unmaskedValue, and numeric typedValue.

    console.log(mask.value); console.log(mask.unmaskedValue); console.log(mask.typedValue);
Check the official README

Growth

Growth trends · Last 30 days

5,182 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
0
Open PRs
17

Development activity is still being collected.

Built with

Categories and tags

Categories

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • inputmask
  • vanilla-js
Stars
5,182
Forks
271
Watchers
27
Open issues
77
Contributors
31
Owner type
User
Primary language
TypeScript
License
MIT
Repository last updated
Oct 11, 2024
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?