AppPhoneNumberInput
A phone field with a searchable country-code picker built in — code and number in one control.
<app-phone-number-input label="Mobile" name="mobile" country="IN" />A phone input captures a dialable number together with its country dial-code, from one control with a searchable country picker. <app-phone-number-input> is the one way to collect a phone number; never pair a separate country select with a plain input — the two drift out of sync.
It renders the shared <wui-phone> control and takes its look entirely from @webority/theme, so the Razor <app-phone-number-input> and the React <AppPhoneNumberInput> render an identical field on every Webority surface.
The country flags are an opt-in stylesheet, not part of wui-components. A site that renders this input links _content/Webority.Ui.Razor/css/webority-flags.css after the theme stylesheet, or imports @webority/theme/scss/flags once after wui-components in its own SCSS; without it every flag is an empty grey box.
Playground
Every attribute, live. Each change re-renders the real tag helper on the server, so the markup underneath is the exact call that produced the field above it. Open the dial-code picker and type in its search box to try the full 245-country filter.
<wui-phone>, so what you try here is byte-for-byte what ships on both surfaces.Flag & dial code
Both parts of the country adornment are independently toggleable. show-flag hides the flag; show-dial-code hides the +country-code. The country picker (chevron) stays, so the country is still selectable even with both off.
default — flag + codeshow-flag="false"show-dial-code="false"both offShow code
<app-phone-number-input label="Mobile" show-flag="false" /> <!-- +91 only --> <app-phone-number-input label="Mobile" show-dial-code="false" /> <!-- flag only --> <app-phone-number-input label="Mobile" show-flag="false" show-dial-code="false" />
Sizes
Three sizes mirror AppInput's ladder — sm / md / lg. md is the default 44px control height; sm and lg step the height, corner radius, and text together so a phone field always matches the inputs beside it in a form.
size="sm"(default) — mdsize="lg"Show code
<app-phone-number-input label="Mobile" size="sm" /> <app-phone-number-input label="Mobile" /> <!-- md — default --> <app-phone-number-input label="Mobile" size="lg" />
Country code + number
The dial-code picker and the number share one field. country sets the starting country; value seeds the number and it posts under name.
Show code
<app-phone-number-input label="Mobile" name="mobile" country="IN" />
Label and required
label renders above the field; required adds the asterisk marker. Always label a phone field — the country picker alone doesn't say what the number is for.
Show code
<app-phone-number-input label="Contact number" name="contactNumber" country="IN" required="true" />
Error state
Pass error to show a field-level message below the control — the standard field-error treatment.
Show code
<app-phone-number-input label="Phone" name="phone" country="IN" required="true" error="Enter a valid phone number" />
When to use
Use it when
- Collecting an international phone number where the country dial-code matters.
- A signup or contact form that needs a valid, dialable number.
- You want one field the user can’t desync — code and number captured together.
Reach for something else when
- The value is any non-phone text. → AppInput
- It is a generic numeric value (quantity, amount). → AppInput
- You need a date rather than a number. → AppDatePicker
- You are picking from a fixed list of labels. → AppSelect
Best practices
Every option
The whole surface of the component, one cell per value — a representative sample of the 245-country picker (the full list is search-filterable inside the picker itself), national vs. international seed values, and every field state.
country — a representative sample
country="IN"
country="US"
country="GB"
country="AE"
country="SG"
country="AU"
country="FR"
country="DE"
country="JP"
country="ZA"
country="BR"
country="NG"
value — national digits vs. international (e164)
(empty)
value="9876543210" — national digits, country="IN"
value="+919876543210" — same number, international
value="+14155552671" — international, picker follows to US
value with a leading + and the control parses the dial code and switches the picker to match, even when country was set to something else — the last cell above starts at country="IN" but resolves to the US.state
(default)requireddisableddisabled + valueerror="…"required + errorlabel
(default) — "Phone number"label="Contact number"label="" — no label, no accessible nameAttributes
| Attribute | Type | Default | Description |
|---|---|---|---|
| label | string | Phone number | Field label above the control. |
| name | string | — | Form field name the number posts under; pairs with the label. |
| value | string | — | Initial phone number. |
| country | string | detected | Initial country ISO code, e.g. IN, US, GB. Omit it and the control starts on the viewer's country, from the browser's time zone, then its language, then IN. |
| size | sm | md | lg | md | Control size — mirrors AppInput's ladder. sm/lg step the height, radius, and text. |
| placeholder | string | Enter phone number | Empty-state hint inside the number field. |
| required | bool | false | Adds the required marker to the label. |
| error | string | — | Field-level error message shown below the control. |
| disabled | bool | false | Disable the control. |
| show-flag | bool | true | Show the country flag in the adornment. Set false to hide it. |
| show-dial-code | bool | true | Show the +country-code (e.g. +91) in the adornment. Set false to hide it; the country picker (chevron) stays. |
| input-class | string | — | Extra classes on the control itself (the wui-phone) — the React className counterpart. The plain class attribute merges onto the .field wrapper instead. |