Extras
PhoneInput
Bit.BlazorUI.Extras
BitPhoneInput pairs a searchable country selector - flag, name and dialing code - with a tel input. Value always holds the full number in E.164 form (+[code][number]), while the local digits and the country stay bindable on their own through Number and Country. A typed or pasted international prefix picks its country, the digits can be laid out over a per-country pattern, and the whole field is keyboard and screen-reader operable.
Events & forms
The events, opening the list and setting the number from code, posting a plain HTML form, keyboard and autofill hints, and translating every text.
Events
OnCountryChange fires for a picked or a typed-in country, OnOpen / OnClose follow the
list, OnSearch reports the search term and OnChange the E.164 value. The number input also
raises OnFocus, OnBlur, OnFocusIn, OnFocusOut, OnClick,
OnKeyDown, OnEnter and OnEscape.
Selected country:
Value:
Search text:
Callout: closed
Enter pressed: 0
Programmatic control
IsOpen is two-way bindable, and a reference offers OpenAsync, CloseAsync,
SelectCountryAsync, SetNumberAsync (which resolves an international prefix the way typing
does), ClearAsync, FocusAsync and FullNumber. Picking a country moves the focus to the
number input unless NoFocusOnSelect is set.
IsOpen: False
Form submission
For a plain HTML form, Name posts the full E.164 Value through a hidden field (the visible input
holds only the local part), and CountryName posts the ISO 3166-1 alpha-2 code of the country.
Posted as phone:
Posted as phoneCountry: CA
Keyboard & autofill
The number is a
tel input with autocomplete="tel" and no spellcheck or
autocorrect. AutoComplete names another autofill token (tel-national,
off), InputMode another on-screen keyboard, and EnterKeyHint labels its
return key.
Localization
Every text the field shows or announces can be translated. Country names come from Countries;
DropdownAriaLabel prefixes the selector's spoken name ("Land: Deutschland"); the search box, the
empty result and the clear button take SearchBoxPlaceholder, SearchBoxAriaLabel,
NoResultsText and ClearButtonAriaLabel; and SearchResultsAnnouncement phrases the
result count a screen reader hears.
Feedback
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.