PhoneNumberInput.Blazor 10.0.11

dotnet add package PhoneNumberInput.Blazor --version 10.0.11
                    
NuGet\Install-Package PhoneNumberInput.Blazor -Version 10.0.11
                    
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="PhoneNumberInput.Blazor" Version="10.0.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PhoneNumberInput.Blazor" Version="10.0.11" />
                    
Directory.Packages.props
<PackageReference Include="PhoneNumberInput.Blazor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PhoneNumberInput.Blazor --version 10.0.11
                    
#r "nuget: PhoneNumberInput.Blazor, 10.0.11"
                    
#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.
#:package PhoneNumberInput.Blazor@10.0.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PhoneNumberInput.Blazor&version=10.0.11
                    
Install as a Cake Addin
#tool nuget:?package=PhoneNumberInput.Blazor&version=10.0.11
                    
Install as a Cake Tool

Blazor Custom Input Phone Number Component

This library provides a reusable Blazor component for phone number input. The component integrates logic for continent and country selection, automatic filtering of the country list, and visual validation, making data entry simpler and more intuitive for end users.

🚀 Key Features

  • Dynamic Filtering: Automatically updates the list of available countries based on the selected continent.
  • Two-Way Data Binding: Full support for @bind syntax for phone numbers, countries, and continents.
  • Customizable Validation: Visual feedback through styled input borders based on the required status.
  • Modularity: Option to include or exclude dropdown menus via component parameters.
  • Modern UI: Built on the Bootstrap 5 framework for a responsive and consistent look.
  • Local SVG Flags Integration: Built-in high-quality local SVG flag support with customizable aspect ratios (1x1 square and 4x3 rectangular formats).

🛠️ Installation and API Reference

To use the component, add a reference to the PhoneNumberComponentLibrary and ensure Bootstrap 5 CSS/JS is loaded in your application.

Usage Example

<PhoneNumberInput 
    @bind-PhoneNumber="userPhone" 
    @bind-SelectedCountry="userCountry"
    IncludeContinentSelect="true"
    IsRequired="true"
    ShowFlags="true" 
    FlagFormat="FlagFormatEnum.Rectangle4x3"/>

Screenshot 1 Screenshot 2 Screenshot 3

Component Parameters

The component supports the following configuration parameters:

  • IncludeContinentSelect (bool, default: true): Shows or hides the continent dropdown.
  • IncludeCountrySelect (bool, default: true): Shows or hides the country dropdown.
  • IsRequired (bool?, default: false): Enables visual validation by applying red/green borders based on input state.
  • Placeholder (string, default: "Enter phone number"): Custom text displayed when the input is empty.
  • AutoComplete (string, default: "off"): Sets the standard HTML autocomplete attribute.
  • ShowFlags (bool, default: true): Enables or disables the rendering of country flags in the dropdown and selection buttons.
  • FlagFormat (FlagFormatEnum, default: FlagFormatEnum.Rectangle4x3): Specifies the aspect ratio for the displayed flags.
  • FlagWidth (string, default: "20px"): Custom CSS width for the rendered flag image.
  • FlagHeight (string, default: "15px"): Custom CSS height for the rendered flag image.
  • ContinentMinWidth (string, default: "4rem"): Minimum CSS width constraint for the continent dropdown button.
  • ContinentMaxWidth (string?, default: null): Maximum CSS width constraint for the continent dropdown button.
  • CountryMinWidth (string, default: "4rem"): Minimum CSS width constraint for the country dropdown button.
  • CountryMaxWidth (string?, default: null): Maximum CSS width constraint for the country dropdown button.
  • InputMinWidth (string?, default: null): Minimum CSS width constraint for the phone number input field.
  • InputMaxWidth (string?, default: null): Maximum CSS width constraint for the phone number input field.
  • CustomContainerClass (string?, default: null): Custom CSS classes for the main wrapper container element.
  • CustomContinentButtonClass (string?, default: null): Custom CSS classes for the continent selection dropdown button.
  • CustomCountryButtonClass (string?, default: null): Custom CSS classes for the country selection dropdown button.
  • CustomInputClass (string?, default: null): Custom CSS classes for the phone number text input field.
  • CustomDropdownMenuClass (string?, default: null): Custom CSS classes for the dropdown menus.

📂 Project Structure

  • /PhoneNumberComponentLibrary: Source code for the component, models, enum definitions, and local static assets (wwwroot/flags).
  • /PhoneNumberComponentTestApp: Blazor application for testing and demonstrating the component functionality.

📄 License

This project is licensed under the CC0-1.0 license (Public Domain). Feel free to use, modify, and distribute the code without any restrictions.

📧 Contact

If you have any questions, encounter issues, or need assistance with the component, feel free to reach out via email: periczeljkosmederevo@yahoo.com.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.11 94 9/7/2026
10.0.0 103 9/6/2026
1.0.0 130 5/22/2026

- Added support for local SVG country flags in the dropdown and selection buttons (supports 1x1 and 4x3 flag sets).
- Added 'ShowFlags' parameter to easily toggle flag visibility on or off.