Inputs · PhoneNumberInputstable
Phone number input
Collects a phone number with its country code. The country part shows a flag and dial code and opens a searchable list; the number formats as you type and is stored as E.164.
Preview
#previewSwitch size, validation and state. The React and CSS tabs update with the preview.
size medium · defaultCountry US · value stored as E.164
phone-field.tsx
import { PhoneNumberInput } from "@blade-ai/weft/components/phone-number-input";
export function LoginPhone({ value, error, onChange, onBlur }: Props) {
return (
<PhoneNumberInput
label="Phone number"
defaultCountry="US"
value={value}
onChange={({ value }) => onChange(value)}
onBlur={onBlur} // validate on blur, not per keystroke
helpText="We'll send a one-time password to this number."
validationState={error ? "error" : "none"}
errorText={error}
/>
);
}All states
#all-statesField and picker states from the Phone Number Input matrix, shown at size medium.
Empty
Typing
Filled
Hover
Focus-visible
United States+1
Canada+1
United Kingdom+44
India+91
United Arab Emirates+971
Australia+61
Germany+49
France+33
Spain+34
Italy+39
Netherlands+31
Belgium+32
Switzerland+41
Austria+43
Sweden+46
Norway+47
Denmark+45
Finland+358
Ireland+353
Portugal+351
Poland+48
Russia+7
Türkiye+90
Saudi Arabia+966
Israel+972
Egypt+20
South Africa+27
Nigeria+234
Kenya+254
Pakistan+92
Bangladesh+880
Sri Lanka+94
Nepal+977
China+86
Hong Kong+852
Japan+81
South Korea+82
Singapore+65
Malaysia+60
Thailand+66
Vietnam+84
Philippines+63
Indonesia+62
New Zealand+64
Brazil+55
Mexico+52
Argentina+54
Chile+56
Colombia+57
Country picker open
Disabled
Read-only
Loading
Invalid
Success
India (+91)
Props
#propsBooleans are is-prefixed; show* toggles keep Blade's names. label is required.
Prop
Type
Default
Description
label *
string
"Phone number"
Visible label that names both the picker and the number.
labelPosition
"top" | "left"
"top"
Label above or beside the field.
defaultCountry
string
"US"
ISO 3166-1 alpha-2, must be in allowedCountries. Blade AI is US-focused.
allowedCountries
string[]
—
Limit the country list (ISO codes). Default: the built-in list; the full "all countries" list is UNDEFINED · needs decision.
showCountry
boolean
true
Show the flag and the country picker.
showDialCode
boolean
true
Show the dial code next to the flag.
value · defaultValue
string (E.164)
""
Number in E.164, e.g. "+14155550132". Displayed formatted for the country.
onChange
({ value, phoneNumber, country, dialCode, isValid }) => void
—
Called on every edit and country change. value = E.164; phoneNumber = national, formatted.
onBlur
(event) => void
—
Called when focus leaves the whole field (not when moving picker → number). Validate here.
onCountryChange
({ country, dialCode }) => void
—
Fires on picker select and on paste auto-detect.
placeholder
string
"(201) 555-0123"
Hint inside the number part; defaults to an example for the selected country.
size
"small" | "medium" | "large"
"medium"
Height 32 / 36 / 48px.
validationState
"none" | "error" | "success"
"none"
Validation feedback; the app sets it on blur.
helpText · errorText · successText
ReactNode
—
Why the number is needed; errorText and successText replace helpText.
isDisabled · isRequired
boolean
false
Disabled: neither part focusable, not submitted. Required adds the necessity indicator and aria-required.
isLoading
boolean
false
Spinner replaces the chevron; aria-busy. Editable while loading: UNDEFINED · needs decision (fallback: editable).
isReadOnly
boolean
false
Focusable and submitted; the picker does not open. Visual treatment: UNDEFINED · needs decision.
name
string
—
Form field name; submits the E.164 value.
autoFocus
boolean
false
Focuses the number, not the picker.
Usage
#usageShort rules for phone fields.
Do
Always show a visible label that names both parts; use the placeholder only as a country example.
Default to US +1 (or the account's country) and keep the list searchable.
Set type="tel", inputmode="tel" and autocomplete="tel" so keypads and autofill work.
Store E.164; display the national format and format as the user types.
Auto-select the country when a +number is pasted or autofilled.
Use the exact tokens in the States table; one border and one ring wrap the whole field.
Don't
Don't split the number or the dial code into separate fields.
Don't validate mid-typing or show help and error text together.
Don't reject spaces, dashes, brackets or a leading 0 — strip them.
Don't block paste.
Don't treat a dial-code-only value ("+1") as invalid — it is empty.
Don't show the country name in the trigger — flag + dial code only.
Don't build anything marked UNDEFINED until it has a decision.
Accessibility
#accessibilityA grouped country combobox and a native tel input under one label.
Keyboard
Key
Action
Tab / Shift+Tab
Picker → number → next field, and back. Both parts are tab stops.
Enter / Space / ↓ / Alt+↓ (picker)
Opens the country list; focus goes to its search field; the selected country is active.
Letters (picker closed)
Typeahead: jumps to the next country starting with the typed letters ("in" → India) without opening the list; resets after 500ms.
Type (list open)
Filters by country name, ISO code or dial code ("+44"); first match becomes active.
↑ / ↓ · Home / End · Enter
Moves the active option; Enter selects, closes the list and moves focus to the number.
Escape
Closes the list without changing the country; focus returns to the picker.
Digits / Backspace / Cmd + V (number)
Native editing; formatting re-applies after each change; paste of +number auto-selects the country. Enter submits the form.
ARIA
Element
Role / attribute
When
Group wrapper
role="group" aria-labelledby="{labelId}"
Always
Country picker
role="combobox" aria-haspopup="listbox" aria-expanded aria-controls="{listId}" · accessible name "Country: United States, +1"
showCountry = true
Country list
role="listbox" · role="option" aria-selected · search input aria-activedescendant="{optionId}"
List open
<input> (number)
type="tel" inputmode="tel" autocomplete="tel" · label via <label for>
Always
<input> (number)
aria-describedby="{messageId}" · aria-invalid="true"
Help / error shown · validationState = error
Group wrapper
aria-busy="true"
isLoading
Picker + number
aria-required="true" · disabled · aria-readonly="true" (picker) / readOnly (input)
isRequired · isDisabled · isReadOnly
Flag · chevron · spinner
aria-hidden="true" (country is in the picker's name)
Always
No-results message
role="status" aria-live="polite"
Query matches no country
Agent Spec
#agent-specMachine-readable spec, tables (a)–(g). Same source as /specs/phone-number-input.json and llms.txt.
/specs/phone-number-input.json·component: "PhoneNumberInput"·package: "@blade-ai/weft"·updated 2026-11-24
PropertyValueToken
Height32 / 36 / 48size.32 · size.36 · size.48
Horizontal paddingpicker 12 / 8 (small 8 / 6) · number 12 (small, large 8)picker spacing.4 / spacing.3 (small spacing.3 / spacing.15) · number spacing.4 (small, large spacing.3)
Picker gap (flag · dial code · chevron)6 (small, large 4)spacing.15 (small, large spacing.2)
Chevron / spinner / flag14 small, medium · 16 large · flag 16 × 12size.14 · size.16 · colour surface.icon.gray.muted
Number / dial code / placeholder13 / 20 / 400 (14 on large)fonts.size.1200 / lineHeights.100 (fonts.size.100 on large)
Label ↔ field ↔ help gaptop 8 · left 12spacing.3 · spacing.4
Help / error / success text12 / 16 / 400 · tracking 0.01emfonts.size.75 / lineHeights.50 / letterSpacings.200
Left label column80no token · matches Text Input
Border · divider · ring1 · 1 · 3border.width.thin · interactive.border.gray.default · border.width.3 + interactive.border.primary.faded
Radius · disabled opacity0 · 50%border.radius.none · opacity.600
Country listoption min 32 · list max 240 · width = fieldsize.32 · size.240 · list padding spacing.2 · option padding spacing.3