Skip to content

Extras

CountryPicker

Bit.BlazorUI.ExtrasCountrySelectorCountrySelect

BitCountryPicker picks a country out of a searchable list that shows the flag and the name of each one - for the billing country, the nationality or the country of residence a form asks for. Value is the selected BitCountry; the list can be replaced, trimmed and reordered, searched by name or ISO code, and the whole field is keyboard and screen-reader operable.

Customization

Defaults through BitParams, colors, external icons, sizes, styling every part of the picker, and right-to-left layouts.

Cascading parameters

BitParams hands a BitCountryPickerParams to every country picker 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 picker keeps any parameter it sets itself. What belongs to one field only (Value, DefaultValue, IsOpen, Name, Invalid, ErrorMessage 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

ResponsiveCloseIcon takes the icon of the close button of the responsive panel from any CSS-class based library (FontAwesome, Bootstrap Icons) as raw classes or through the BitIconInfo helpers, and wins over ResponsiveCloseIconName. Reference the library's stylesheet in your app, and narrow the window to see it.

Size

Size scales the height, padding, text, flags and list rows together.

Style & Class

The public --bit-CountryPicker-* 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 pickers inside it, or in one picker'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 picker (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.

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.