Forms

Phone

An international phone number field: a country picker with the flag and the calling code, and the number typed after it. The value is the full number in E.164 (+5511987654321).

Phone: null
Blade

A field with "🇧🇷 +55" and a small chevron at its start, then the number. The country starts as the one of the app's locale (pt_BR gives Brazil, en the United States). Clicking the code opens the list of countries, in the app's language, with their flags and codes. Typing 11 98765-4321 sets $phone to '+5511987654321'; a number that starts with + selects its country.

Fewer countries #

Only Portugal, Brazil, Angola and Mozambique in the list, starting on Portugal.

Mobile: null
Blade

In a classic form #

Outside Livewire the form sends the full number under phone, and value (or the old input after a failed submit) fills the field and picks its country.

Blade

Reference

Phone

Prop Type Default Description
country string the locale's The country selected first, as its two-letter code.
countries array all The codes of the countries in the list.
value string null The full number, without wire:model or x-model.
size string md xs, sm, md, lg, xl, 2xl or 3xl.

Also accepts the props of Input (label, description, help, placeholder, disabled, readonly...). wire:model and x-model bind the full number, or null when the field is empty.

Customization

Classes and attributes go to the field as on Input. country: reaches the country <select>.

blade

Accessibility

The country picker is a native <select> named "Country", over the flag and code it shows, so the keyboard and screen readers use it as any select. The number is an <input type="tel"> with its label. With disabled or readonly the country select is disabled too.

Behavior notes

  • The number is not validated: check it on the server (regex:/^\+[1-9]\d{6,14}$/, or a package such as propaganistas/laravel-phone).
  • A leading 0 typed in the number (the trunk prefix) is dropped, except for Italy, San Marino and Vatican City, where it is part of the number.
  • Countries that share a code (+1, +44, +7) keep the one selected when the number arrives from the server.
  • The flags are emoji: on Windows they show as the two letters of the country.