BlazorCleave
A Blazor class library for cleave.js
Install / Use
/learn @TaylorAdamCA/BlazorCleaveREADME
BlazorCleave
A Blazor class library that wraps the functionality of Cleave.js.
Usage
-
In a Blazor Server or Blazor WebAssembly project, add a reference to the
BlazorCleavepackage. -
In your
_Imports.razorfile, add the following statements:
@using BlazorCleave
@using BlazorCleave.Data
- In your
_Host.cshtml(for Blazor Server) orindex.html(for Blazor WebAssembly) file, add the following tags somewhere before the reference to the Blazor.jsfile:
<script src="_content/BlazorCleave/BlazorCleave.js"></script>
<script src="_content/BlazorCleave/cleave-phone.i18n.js"></script>
- If you want to add some default styling, in your
_Host.cshtml(for Blazor Server) orindex.html(for Blazor WebAssembly) file add the following after your current stylesheet link:
<link href="_content/BlazorCleave/style.css" rel="stylesheet" />
You're now ready to use the package. For example, inside a .razor file,
//Time formatting
<Cleave Placeholder="hh:mm" TimeFormat="@( new TimeFormat{
Format = new[] { 'h', 'm' }
})" InputType="InputType.Time" />
// Date formatting
<Cleave Placeholder="YYYY/MM/DD" DateFormat="@(new DateFormat{
Delimiter = '/',
Format = new char[] { 'Y', 'm', 'd' }
})" InputType="InputType.Date" />
// Phone number formatting
<Cleave Placeholder="Phone Number" CountryCode="CountryCode.CA" InputType="InputType.PhoneNumber" />
// Credit card formatting
<Cleave Placeholder="Credit Card" InputType="InputType.CreditCard" />
// Numeral formatting
<Cleave Placeholder="Numeral formatting" InputType="NumeralTypes.Type.Thousand" />
Notes
This is still a WIP, although it does work well, there is always improvements to be made.
Please contribute if you have any suggestions/reccomendations.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
