Phone field with country code
A phone field with a country picker: the number is formatted while typing, its length is checked and it is sent in international format.
- Tailwind
- React
- CSS
- WordPress
Description
The visitor picks their country (France, Belgium, Switzerland, Luxembourg, Canada) then types their number as usual: digits group themselves (06 12 34 56 78, 0470 12 34 56, 514 555 0123) and the hint under the field shows the international format once the number is complete. A number pasted with its country code (+33 or 0033) is brought back to the national form. On leaving the field or submitting, a wrong length is flagged with aria-invalid and a clear message linked to the field, with an example for the chosen country. A hidden field sends the number in E.164 format (+33612345678), ready for an SMS tool or a CRM. Per-country rules (code, digit groups, lengths, leading zero) are described in JSON and easy to extend. Labelled native fields in a fieldset, suitable autocomplete values, confirmation in a role="status" region, AA contrast in light and dark mode, stacked columns at 360 px.
Code
Loading the code…
The code of this component in
Archive contents
champ-telephone-indicatif-html-tailwind.zip3 files · 5 Ko
- index.html7 Ko
- README.md4 Ko
- LICENSE.md1 Ko
Tags
Updated on December 3, 2026.
Reviews
No reviews yet.
In the same spirit

A recruitment form for small businesses: target position, introduction, CV checked in the browser and GDPR consent, with inline errors.
- Tailwind
- React
- CSS
- WordPress

A quote request form for tradespeople: the customer describes the work, picks a start date range and attaches up to six site photos, each with a preview, its size and a button to remove it.
- Tailwind
- React
- CSS
- WordPress

A quote request form whose labels, hints and error messages are full French sentences, still readable at 320 px: nothing overflows, nothing is cut off, and each error is tied to its field.
- Tailwind
- React
- CSS
- WordPress

Visitors pick a package and tick options: the pre-tax total, VAT and total including tax update live, and the summary is sent with the contact form.
- Tailwind
- React
- CSS
- WordPress