Phone Input

An international phone number input with country selection and formatting.

Overview

PhoneInput combines a country selector and phone number field into one attached input group. It uses Cubitt Button, Input, and Combobox primitives under the hood, with international formatting from react-phone-number-input.

Usage

import { PhoneInput } from "@tilt-legal/cubitt-components/phone-input";
<PhoneInput placeholder="Enter phone number" />

Examples

States

Default, error, disabled, and readonly states.

Basic

A standard phone input with country selection.

Sizes

Phone input in different sizes.

API Reference

PhoneInput

PropTypeDefaultDescription
valuestringPhone number value in E.164 format.
onChange(value: string) => voidCallback when the phone number changes.
size"sm" | "md" | "lg""md"Input size.
placeholderstringPlaceholder text for the phone number field.
disabledbooleanfalseDisables the country selector and phone number field.
readOnlybooleanfalseMakes the number readonly and prevents country selector changes.
defaultCountryCountry"AU"Default country code, such as "US", "GB", or "AU".
countriesCountry[]Country codes to display. Shows all countries when omitted.
popupClassNamestringAdditional classes for the country selection popup.
classNamestringAdditional classes for the phone number input element.
aria-invalidbooleanApplies error styling to the phone number input.

Types

import type { PhoneCountry } from "@tilt-legal/cubitt-components/phone-input";

PhoneCountry is the Country type from react-phone-number-input.

On this page