raphadesa / BlazorInputMask

Blazor Input Mask
MIT License
26 stars 15 forks source link

Blazor Input Mask

Nuget Package : https://www.nuget.org/packages/BlazorInputMask/

Install-Package BlazorInputMask

Blazor Input Mask (based on https://imask.js.org/)

Use like that:

<EditForm Model="..

<InputMask @bind-Value="user.Telephone" class="form-control" data-mask="00.00.00.00.00" OnChanged="..." placeholder="Phone No" />

In your _Host.cshtml or Index.html file:




You can also have the possibility to set an id to the mask (optional), and also retrieve the unmasked value. 06-29-2021 : Added parameter - validateOnKeyPress Additional help in the demo code here : https://github.com/raphadesa/BlazorInputMask/blob/master/BlazorInputMask/Pages/Index.razor 06-13-2021 : RegEx support Usage : (RegEx must start and end with a slash '/') 02-12-22 : Added new parameter returnRawValue true by default Warning: now return value parameter is not rawValue but returnValue. 02-21-2023 : Added function updateMask 03-12-2023 : BREAKING CHANGE New event has been added: OnChanged, which returns both value and the masked raw value. So you don't need to use returnRawValue anymore. 10-14-2023 : Added function clearValue 03-27-2024 : Upgraded NuGet Package for .NET 8