Componentpickers1.14 KB gzipZero dependencies

PhoneInput

Phone number input with country code selector and formatted display

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add phone-input

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { PhoneInput } from "@/components/ui/phone-input"; <PhoneInput defaultValue="+1 (555) 123-4567" onValueChange={(v) => {}} />

Source code

phone-input.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxphone-input.tsx119 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface CountryOption {  code: string;  label: string;  dialCode?: string;  flag?: string;} export interface PhoneInputProps  extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "defaultValue"> {  value?: string;  defaultValue?: string;  onValueChange?: (value: string) => void;  countries?: CountryOption[];

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { PhoneInput } from "@/components/ui/phone-input"; <PhoneInput />
PropTypeDescription
valuestringControlled value.
defaultValuestringInitial value when uncontrolled. (Default: "")
onValueChange(value: string) => voidCallback invoked on value change.
countriesCountryOption[]Configures countries. (Default: COUNTRIES)
classNamestringOptional Tailwind or custom CSS classes merged with component styles.
placeholderstringPlaceholder text shown when empty. (Default: "Phone number")
disabledbooleanDisables interaction and applies disabled styling. (Default: false)