BzBankInput / IranValidation

Iranian tools

Jalali calendar, national-code/IBAN/card validation, and a ready-made bank identifier input.

Jalali calendar

A month view with colour-coded events and holiday detection.

شیدسچپج
جلسه تیم

Picked: 2026/08/11

razor
@using BzCore.Components.Calendar
@using BzCore.Enums

<BzCalendarView SelectedDate="_picked"
                OnDayClick="@(d => _picked = d)"
                Events="_events"
                Calendar="BzCalendarType.Jalali"
                ShowHolidays="true" />

<p>انتخاب: @_picked.ToString("yyyy/MM/dd")</p>

@code {
    private DateTime _picked = DateTime.Today;

    // BzCalendarEvent(date, title, color)
    private List<BzCalendarEvent> _events = new()
    {
        new(DateTime.Today, "جلسه تیم", BzColor.Primary),
        new(DateTime.Today.AddDays(2), "تحویل پروژه", BzColor.Danger),
        new(DateTime.Today.AddDays(5), "انتشار نسخه", BzColor.Success),
    };
}
Live validation

The static IranValidation class works on its own, without any component — in your services, for example.

National code
Mobile
Card number
IBAN
Method Description
IsNationalCode(s)10-digit national code with its check digit
IsMobile(s)An Iranian mobile number
IsBankCard(s)16-digit card, Luhn checked
GetCardBank(s)The bank name from a card number
IsIban(s)IBAN, mod97 checked
GetIbanBank(s)The bank name from an IBAN
razor
@using BzCore.Components.Input
@using BzCore.Enums

<BzInput TValue="string" @bind-Value="_nc" Label="کد ملی"
         CharFilter="BzCharFilter.NumberOnly" MaxLength="10"
         UpdateTrigger="BzUpdateTrigger.OnInput" StartIcon="fa-solid fa-id-card" />

<span class="iz @(string.IsNullOrEmpty(_nc) ? "" : (IranValidation.IsNationalCode(_nc) ? "ok" : "bad"))">
    @(string.IsNullOrEmpty(_nc) ? "" : (IranValidation.IsNationalCode(_nc) ? "معتبر" : "نامعتبر"))
</span>

<BzInput TValue="string" @bind-Value="_card" Label="شماره کارت"
         Mode="BzInputMode.Mask" Mask="####-####-####-####"
         UpdateTrigger="BzUpdateTrigger.OnInput" />

@if (!string.IsNullOrEmpty(_card))
{
    <span>
        @(IranValidation.IsBankCard(_card) ? "معتبر" : "نامعتبر")
        @if (IranValidation.GetCardBank(_card) is { } bank)
        {
            <text> — بانک @bank</text>
        }
    </span>
}

@code {
    private string? _nc;
    private string? _card;
}

@*
IranValidation is a plain static class — use it anywhere, even outside Blazor:

    IranValidation.IsNationalCode(s)
    IranValidation.IsMobile(s)
    IranValidation.IsBankCard(s)   /  GetCardBank(s)
    IranValidation.IsIban(s)       /  GetIbanBank(s)

On your models you can use the attributes instead:
    [NationalCode] [IranMobile] [Sheba] [BankCard]
*@
Bank & identity input

BzBankInput does all of the above for you: masking, validation and bank detection. Just change Type.

CardNumber
---
Restricted banks
---
Iban
IR-----
AccountNumber
---
NationalCode
-
-
LegalId
-
-
Type Description
CardNumber16-digit card, Luhn + bank detection
IbanIBAN, mod-97 + bank detection
AccountNumberAccount number with a custom Length
NationalCodeNational code; ShowLocation adds province and city
LegalIdLegal entity ID (11 digits)
ForeignerIdForeign national ID
PassportPassport number
CustomA custom format
razor
@using BzCore.Components.Form
@using BzCore.Enums

@* Card number — masks, Luhn-checks and detects the bank on its own *@
<BzBankInput Type="BzIdentifierType.CardNumber" @bind-Value="_card" Label="شماره کارت" />

@* Only accept cards from certain banks *@
<BzBankInput Type="BzIdentifierType.CardNumber" @bind-Value="_card2"
             AllowedBanks="@(new(){ BzBank.Mellat, BzBank.Melli })"
             Label="فقط کارت ملت یا ملی" />

@* IBAN — mod-97 checked, bank detected *@
<BzBankInput Type="BzIdentifierType.Iban" @bind-Value="_sheba" Label="شماره شبا" />

@* Account number with a fixed length *@
<BzBankInput Type="BzIdentifierType.AccountNumber" @bind-Value="_acct" Length="13"
             Label="شماره حساب (13 رقم)" ShowBank="false" />

@* National code — ShowLocation also resolves the issuing province and city *@
<BzBankInput Type="BzIdentifierType.NationalCode" @bind-Value="_nc"
             ShowLocation="true" ShowBank="false"
             Label="کد ملی (با تشخیص استان و شهر)" />

@* Legal entity national ID *@
<BzBankInput Type="BzIdentifierType.LegalId" @bind-Value="_legal"
             ShowBank="false" Label="شناسه ملی حقوقی" />

@code {
    private string? _card, _card2, _sheba, _acct, _nc, _legal;
}