Phone input
A phone number with its country. A button with the flag and dial code opens a searchable list of countries, the number is formatted as it is typed, and the form gets it in E.164.
npx shadcn add https://kinoui.com/r/phone-input.jsonCopy install command
Examples
Default
Pick a country and type the number: it is formatted as you go, and the form gets it in E.164.
Pasting
A number pasted or autofilled with its code, or with an exit code such as 00, moves the country to it.
- Value
- +12025550147
- Country
- US
Controlled
Own value and country, such as a number saved on an account.
Countries
Offer only the countries you serve with countries.
Installation
Copy code
npx shadcn@latest add https://kinoui.com/r/phone-input.json- Files
lib/refs.tslib/reduce-motion.tscomponents/kino/input.tsxcomponents/kino/textarea.tsxlib/resize.tslib/swap.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxcomponents/kino/input-group.tsxlib/scroll.tslib/popup.tslib/glide.tsxcomponents/kino/tooltip.tsxlib/cut.tsxcomponents/kino/label.tsxcomponents/kino/separator.tsxlib/run-progress.tslib/highlight.tslib/menu.tsxcomponents/kino/select.tsxlib/filter-list.tsxlib/chip.tsxlib/flow.tscomponents/kino/combobox.tsxlib/field-control.tsxlib/addon-picker.tsxlib/countries.tsxlib/phone-number.tslib/dates.tscomponents/kino/phone-input.tsx- Packages
@base-ui/reactclass-variance-authoritycountry-flag-iconslibphonenumber-js- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
Props
Data attributes
Accessibility
- The country button is named for the pick, such as “Country: United Kingdom (+44)”, so a screen reader and speech control hear what it shows.
- The list is a combobox with a search: arrow keys move through it, Enter picks, and Escape closes it and returns to the button. A pick sends focus straight to the number.
- The number is a
telinput withautocomplete="tel", so phones show a keypad and browsers fill a saved number, which the field reads with its code. - Backspace next to a space or bracket deletes the digit beyond it, and the caret stays after the same digit as the number is regrouped.
- A number that isn’t whole fails the field’s check with “Enter the whole phone number.”, which
FieldError match="customError"shows. - A disabled Field disables the button too, and a read-only one keeps its list shut. The number reads left to right in every language.