Skip to content

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.

Validation & list

Validation and error messages, the disabled and read-only states, placing and sizing the country list, and templates for the selector, its rows and an empty result.

Validation

Inside an EditForm the data annotations validate the full E.164 Value and the field gets aria-invalid; NoValidate opts out. Outside a form, Invalid marks the field and ErrorMessage (or ErrorMessageTemplate) also writes the reason under it, referenced by aria-describedby and announced when it appears.

ShowValidationMessage shows the messages of the form under the field, where ErrorMessage goes, so the form below needs no ValidationMessage component. The number input is described by them through aria-describedby, so they are read out when it takes the focus, and an ErrorMessage of the app's own wins the place while it is set. They are not announced as they appear: a submit validates every field at once, and a message from each of them read out in a row would bury the form under its own errors. A BitParams holding a BitPhoneInputParams with ShowValidationMessage turns it on for every phone input inside it.

That number is already registered.
Spanish mobile numbers are nine digits long.
That number is already registered.​


Disabled & ReadOnly

Disabled dims both halves and takes them out of the tab order. ReadOnly keeps the number focusable and copyable while refusing edits and country changes; the selector drops its caret and its country is read out with the number.

Disabled:

ReadOnly:

Callout

DropDirection (TopAndBottom by default, or All) and MaxHeight place and size the list. The arrow keys wrap at its ends unless NoWrapNavigation is set; Home, End, Page Up and Page Down move through it too, and Escape or Alt+Up close it. Responsive turns it into a full-height side panel on small screens, with the Label and a close button (ResponsiveCloseIconName, ResponsiveCloseButtonAriaLabel) - narrow the window to see it.

DropDirection="All" + MaxHeight="200":

NoWrapNavigation (open it and hold the up arrow):

Templates

DropdownTemplate renders the selector's content from the selected country, ItemTemplate each row, and NoResultsTemplate the empty result.

Feedback

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