build69
build69  /  Components  /  Masked & Validated  /  PhoneInput

PhoneInput

v1.0.1Updated 20 Jul 2026

Phone number field with the country dial code baked into the mask — Thailand `+66 XX XXX XXXX` by default, plus US, UK and Singapore formats. The prefix is fixed mask text rather than a separate overlay, so the accepted value always carries the full international number. Renders monospace tabular figures and sets inputMode="tel" and autoComplete="tel".

Preview

Live · 4 stories
Country FormatsOpen ↗
Why this is recommendedformmaskinputphone+5

PhoneInput — country formats.

Recommended for+14
  • Thai phone number entry
  • Collecting a mobile number at signup
  • Business or contact phone fields on a profile form
  • International phone entry for TH / US / UK / SG
  • Checkout delivery contact number
Tags+6
formmaskinputphonetelthaiinternationalcountryformats
Features+4
  • Four country presets: TH (default), US, UK, SG
  • Dial code embedded in the mask — never doubles up on pre-filled values
  • Per-country placeholder showing a realistic example number
  • inputMode="tel" + autoComplete="tel" for mobile keypads and autofill
  • Monospace tabular-nums so digits do not jitter while typing
  • Sanitised masked value via onAccept
Not recommended for−2
  • Country selection with a flag dropdown and per-country validation (use ValidatedPhoneInput)
  • Countries outside TH / US / UK / SG
  • Free-form text (use Input)

Install

Ask your agent, or call the MCP tool directly. The resolved bundle is written into your project.

get_registry_item({ name: "PhoneInput" })

Usage

import { PhoneInput } from '@/components/inputs/input-mask/phone-input';

<PhoneInput country="TH" value={phone} onAccept={setPhone} />

Tick variants in the left menu — each adds a tab with that variant’s real story source, the same code the preview above renders.

Props

PropTypeRequired
country

Country mask preset (default 'TH')

'TH' | 'US' | 'UK' | 'SG'
value

Current masked value including the dial code

string
onAccept

Fires whenever the masked value changes

(value: string) => void
placeholder

Overrides the country's example placeholder

string
aria-invalid

Renders the destructive border and ring

boolean
disabled

Disables the field; the value stays masked

boolean

Related