IntlTelInput.MudBlazor
1.3.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package IntlTelInput.MudBlazor --version 1.3.1
NuGet\Install-Package IntlTelInput.MudBlazor -Version 1.3.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IntlTelInput.MudBlazor" Version="1.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IntlTelInput.MudBlazor --version 1.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: IntlTelInput.MudBlazor, 1.3.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install IntlTelInput.MudBlazor as a Cake Addin #addin nuget:?package=IntlTelInput.MudBlazor&version=1.3.1 // Install IntlTelInput.MudBlazor as a Cake Tool #tool nuget:?package=IntlTelInput.MudBlazor&version=1.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
International Telephone Input Blazor wrapper
International Telephone Input js library wrapper for Blazor serverside and clientside. Most of the features are supported, but there are some that I have not implemented! If you would like to add them feel free to do so.
Not supported features:
- Custom dropdownContainer
- CustomPlaceholder
- GeoIpLookup
- hiddenInput
- Setters for properties that are configured during initialization
- And some more advanced features such as events
Installation
- Add the nuget package
- Add JS (just copy this)
<script src="./_content/IntlTelInputBlazor/js/intlTelInput.js"></script>
- Link CSS (just copy this)
<link rel="stylesheet" href="./_content/IntlTelInputBlazor/css/intlTelInput.css">
- Register dependencies using IServiceCollection.RegisterIntlTelInput();
builder.Services.RegisterIntlTelInput();
- Profit $$$
Validation
A custom validation attribute is included, see the example below. It is important to note that the included validation attribute works by calling the International Telephone Input library. More specifically isValidNumber method.
Example
<EditForm EditContext="_editContext" OnValidSubmit="OnValidSubmit">
<DataAnnotationsValidator/>
<ValidationSummary/>
<label>Nr. 1:</label>
<IntPhoneNumberInput @bind-Value="_model.IntTelNumber"/>
<label>Nr. 2:</label>
<IntPhoneNumberInput @bind-Value="_model.IntTelNumber2"/>
<button class="btn-primary">Submit</button>
</EditForm>
@code
{
NumberModel _model = new NumberModel();
EditContext _editContext;
protected override void OnInitialized()
{
_editContext = new EditContext(_model);
}
private void OnValidSubmit()
{
var tel1 = _model.IntTelNumber.Number;
var tel2 = _model.IntTelNumber2.Number;
Console.WriteLine($"Number 1: {tel1}; Number 2: {tel2}");
}
}
public class NumberModel
{
[IntlTelephone(ErrorMessage = "Tel. 1 incorrect format")]
public IntlTel IntTelNumber { get; set; }
[IntlTelephone(ErrorMessage = "Tel. 2 incorrect format")]
public IntlTel IntTelNumber2 { get; set; }
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.AspNetCore.Components.Web (>= 6.0.20)
- MudBlazor (>= 6.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fix Interop issue