PhoneInput Blazor API

PhoneInput Properties

NameTypeDefaultDescription
DisabledboolfalseEnables or disables the element.
DropDownClassListIEnumerable<object>N/ASets additional class names to the Input drop down.
DropDownButtonPositionDropDownButtonPositionDropDownButtonPosition.NoneDetermines the position of the drop down button.
DropDownHeightobjectSets the height of the drop down. By default it's set to an empty string. In this case the height of the drop down is controlled by a CSS variable.
DropDownWidthobjectSets the width of the drop down. By default it's set to an empty string. In this case the width of the drop down is controlled by a CSS variable.
MessagesobjectN/ASets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale.
Namestring""Sets or gets the name attribute for the element. Name is used when submiting data inside an HTML form.
NationalModeboolfalseDetermines whether the input will be in international or national mode i.e whether the input will start with '+'.
IsOpenedboolfalseDetermines whether the drop down is opened or not.
OnlyCountriesIEnumerable<object>[]Sets or gets an array of country codes which will be used instead of the default one with all countries. The country code should be ISO 3166-1 alpha-2 codes(https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
Placeholderstring""Determines the placeholder of the input.
SelectedCountrystring""Sets or gets the selected country of the element. The country code should be ISO 3166-1 alpha-2 codes(https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
RightToLeftboolfalseSets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts.
Themestring""Determines the theme for the element. Themes define the look of the elements.
UnfocusableboolfalseIf is set to true, the element cannot be focused.
Valuestring""Sets or gets the value of the element.

PhoneInput Methods

NameTypeArgumentsDescription
ClosevoidN/ACloses the drop down.
EnsureVisiblevoidN/AEnsures that the active ( selected ) item is always visible.
GetIsOpenedAsync()Task<bool>'N/A'Gets the &quot;IsOpened&quot; property as Task&lt;bool&gt;.
GetItemByDialCodeobjectstring dialCodeReturns an item by its country dial code. The item is an object with 'label', 'value', 'iso2' and 'dialCode' properties.Args: string dialCode - Returns the national or international phone number
GetItemByDialCodeobjectN/AReturns an item by its country dial code. The item is an object with 'label', 'value', 'iso2' and 'dialCode' properties.
GetNumberstringbool isInternationalReturns the entered phone number with formatting.Args: bool isInternational - When you use 'false', the national phone number will be returned and the international phone number, when you use 'true' as parameter.
GetNumberstringN/AReturns the entered phone number with formatting.
GetSelectedItemobjectN/AReturns the selected item. The item is an object with 'label', 'value', 'iso2' and 'dialCode' properties.
GetValueAsync()Task<string>'N/A'Gets the &quot;Value&quot; property as Task&lt;string&gt;.
IsValidNumberboolN/AReturns true or false depending on whether the entered phone number is valid.
OpenvoidN/AOpens the drop down.
Refreshvoid'N/A'Refreshes the Blazor Component. Performs a layout of the HTML Elements and recalculates the measurements.
Rendervoid'N/A'Re-renders the Blazor Component. This method will make a full re-render.
SelectvoidN/ASelects the text inside the input or if it is <b>readonly</b> then the element is focused.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.
ValidatevoidN/AValidates the entered phone number.

PhoneInput Events

NameTypeDescriptionEvent Detail
OnChangeEventCallback<Event>This event is triggered when the selection is changed.string label- The label of the new selected item., dynamic oldLabel- The label of the item that was previously selected before the event was triggered., dynamic oldValue- The value of the item that was previously selected before the event was triggered., dynamic value- The value of the new selected item.
Changedevent PhoneInputChangedEventHandlerThis event is triggered when the selection is changed.PhoneInputChangedEventArgs
OnChangingEventCallback<Event>This event is triggered on each key up event of the Input, if the value is changed.dynamic oldValue- The previous value before it was changed., dynamic value- The new value.
Changingevent PhoneInputChangingEventHandlerThis event is triggered on each key up event of the Input, if the value is changed.PhoneInputChangingEventArgs
OnItemClickEventCallback<Event>This event is triggered when the user clicks on an item from the popup list.dynamic item- The item that was clicked., string label- The label of the item that was clicked., dynamic value- The value of the item that was clicked.
ItemClickedevent PhoneInputItemClickedEventHandlerThis event is triggered when the user clicks on an item from the popup list.PhoneInputItemClickedEventArgs

Enums

DropDownButtonPosition.None
DropDownButtonPosition.Left
DropDownButtonPosition.Right