Warp Input demo — phone numbers, addresses, money, IDs, signatures and form helpers for Filament. Change or delete anything; the data is reset every hour. warpui.com About Warp Input Docs Ask a question Support
Skip to content

Phone numbers

PhoneInput replaces TextInput for phone numbers. Every number is checked with Google’s phone number data and saved in one form, +16175550123, so the same number is always the same text.

Written the way the country writes it

The number is formatted while you type. The country list on the left decides how: (617) 555-0123 in the United States, 03-1234-5678 in Japan.

Note: Try it

Type 6175550123. Then choose Japan on the left and type 0312345678.

Pasted numbers are read too

A number that starts with + switches the country by itself. Full-width digits, dots and long dashes are read as well.

Note: Try it

Paste +44 20 7946 0958 — the country changes to the United Kingdom. Or type 090−1234−5678.

Extensions

An extension after the number is kept and saved with it (+16175550123;ext=12).

Note: Try it

Type 617-555-0123 ext. 12 and press “Show what would be saved”.

Mobile numbers only

When you leave the field, it shows whether the number is a mobile or a landline. ->types([PhoneType::Mobile]) refuses landlines. This field starts in Japan.

Note: Try it

Type 090-1234-5678 (a mobile) and then 03-1234-5678 (a landline), and press “Show what would be saved”.

Only some countries, saved as typed

->onlyCountries(['US', 'CA']) lists only those countries and refuses the others. ->storeAs(PhoneFormat::National) saves (617) 555-0123 instead of +16175550123.

Note: Try it

Type 6175550123 and press “Show what would be saved”. Then paste +44 20 7946 0958.

Without the country list

For forms used in one country only. Numbers without + are read as numbers of the panel’s country (the United States here).

Note: Try it

Type 6175550123, then +81 3-1234-5678.

Numbers put in by another field

When another field fills this one ($set() in afterStateUpdated), the stored value +81312345678 is shown the same way as a number loaded from the database: numbers of the field’s default country (the United States here) in national format, numbers of other countries with their +. The country button on the left of the field changes to match.

Note: Try it

Choose “Tokyo office” on the left: the phone shows +81 3-1234-5678 and the Japanese flag. Press “Show what would be saved”: it is +81312345678. Then choose “Harbor Supply Co.”: it goes back to (617) 555-0142 and the US flag.

Saved numbers in tables and details

PhoneColumn and PhoneEntry show a saved number the way its country writes it, and clicking it calls the number. Numbers of other countries keep their +.

Note: Try it

Point at a number: it is a tel: link. The Customers list uses PhoneColumn.