Componentpickers1.14 KB gzipZero dependencies
PhoneInput
Phone number input with country code selector and formatted display
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add phone-inputOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { PhoneInput } from "@/components/ui/phone-input"; <PhoneInput defaultValue="+1 (555) 123-4567" onValueChange={(v) => {}} />Source code
phone-input.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| value | string | Controlled value. |
| defaultValue | string | Initial value when uncontrolled. (Default: "") |
| onValueChange | (value: string) => void | Callback invoked on value change. |
| countries | CountryOption[] | Configures countries. (Default: COUNTRIES) |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |
| placeholder | string | Placeholder text shown when empty. (Default: "Phone number") |
| disabled | boolean | Disables interaction and applies disabled styling. (Default: false) |