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.
Customization
Defaults for every field of a subtree through BitParams, colors, external icons, sizes, Style & Class with the CSS variables, and right-to-left fields.
Cascading parameters
BitParams hands a BitPhoneInputParams to every phone input under it - the app's market,
country list, look and translated texts, set once. The visitor's own country is
BitCountries.FindByIso2(RegionInfo.CurrentRegion.TwoLetterISORegionName). A field keeps any parameter it sets itself. What
belongs to one field only (Value, Number, Country, IsOpen, Name, CountryName, Invalid, ErrorMessage,
AutoFocus and the events) is not cascaded.
Color
Color paints the frame and the focus ring in one of the general colors - a semantic one or a
neutral family. A Border kind, when set, takes the frame back and leaves Color the ring.
External Icons
ClearButtonIcon and ResponsiveCloseIcon take icons from any CSS-class based library
(FontAwesome, Bootstrap Icons) as raw classes or through the BitIconInfo helpers, and win over
their ...IconName counterparts. Reference the library's stylesheet in your app.
Size
Size scales the height, padding, text, flags and list rows together.
Style & Class
The public --bit-PhoneInput-* custom properties (see the
CSS variables table) re-skin the field without a selector:
on
:root for the whole app, on an ancestor for the fields inside it, or in one field's
Style. The country list is moved to the end of the body while it is open, yet it keeps inheriting
from the field and every ancestor of it, so a variable set in any of those places re-skins the list as well.
They restyle the default, not a choice: an explicit Color, Background, Border or
Size wins over the variables for what it sets.
Style and Class reach the root, Styles and Classes every part by name.
CSS variables on one field (open its list too):
CSS variables on an ancestor (open its list too):
Style, Class, Styles and Classes:
RTL
Dir="BitDir.Rtl" mirrors the field, the callout and the responsive panel, while the number itself
stays left to right so its digits and separators keep their order.
Feedback
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.