# Phone input

A phone number and its country in one field.

This is the HTML to build it with `dex.css`, for work outside the Dex codebase. Read https://brand.meetdex.ai/design.md first: it says how to set up a page and how to use the stylesheet. The page at https://brand.meetdex.ai/components/phone-input shows the Dex app's own React component, which only works inside the Dex codebase.

## HTML

A joined field (https://brand.meetdex.ai/components/joined-field.md) with the country in front and the number after it.

```html
<label class="dex-form-row">
  <span class="dex-field-label">Phone</span>
  <span class="dex-joined">
    <select aria-label="Country" autocomplete="tel-country-code">
      <option value="GB" selected>🇬🇧 +44</option>
      <option value="IE">🇮🇪 +353</option>
      <option value="US">🇺🇸 +1</option>
    </select>
    <input type="tel" autocomplete="tel-national" placeholder="020 7946 0123" />
  </span>
</label>
```

- **Invalid**: `aria-invalid="true"` on the input, and a `dex-field-error`: "Enter a phone number like 07700 900123."
- **Disabled**: `disabled` on both parts.
- **Read-only**: `readonly` on the input, the country as a `dex-joined-text` in place of the select, and helper text saying where the number came from.

## Rules

- Start on the country most people will be in (the UK for Dex), and always have one.
- Show a filled-in number in its national form, 020 7946 0123, not +44 20 7946 0123: the country already shows it.
- Store the full international number (+442079460123), whatever the field shows.
- The Dex app's country list is a searchable list with flags, and a bottom sheet on a phone. `dex.css` has neither; a native select, as above, is the honest stand-in. For a searchable list, use the combobox (https://brand.meetdex.ai/components/combobox.md).
