Mohammad Shehadeh

Phone Input

Forms 7

About

Phone number field with a country dial-code picker and E.164 output from libphonenumber-js.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Phone Input to your project and fits it to your theme.

Code

How Phone Input is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import * as React from "react";
import {
  PhoneInput,
  PhoneInputCountrySelect,
  PhoneInputField,
} from "@/components/ui/phone-input";

export default function PhoneInputDemo() {
  const [value, setValue] = React.useState("");

  return (
    <div className="flex w-full max-w-sm flex-col gap-2">
      <label htmlFor="phone" className="text-sm font-medium text-foreground">
        Phone number
      </label>
      <PhoneInput id="phone" defaultCountry="US" onValueChange={setValue}>
        <PhoneInputCountrySelect />
        <PhoneInputField />
      </PhoneInput>
      <p className="text-xs text-muted-foreground">E.164: {value || "—"}</p>
    </div>
  );
}

Dependencies

More by Mohammad Shehadeh

View all
  • Ecommerce Category Page

    Ecommerce Category Page

    99
  • Feature Problem Cards

    Feature Problem Cards

    99
  • Split Login

    Split Login

    93
  • Feature Grid Spotlight Cards

    Feature Grid Spotlight Cards

    91
  • Comparison Section

    Comparison Section

    81
  • Rounded Top Footer

    Rounded Top Footer

    79
  • Comparison Table

    Comparison Table

    78
  • FAQ Two Column

    FAQ Two Column

    76

More in Forms

View all
  • Login 1

    Login 1

    64
  • Premium Auth

    Premium Auth

    571
  • Contact Card

    Contact Card

    1.1K
  • Form

    Form

    18
  • Book A Demo 1

    Book A Demo 1

    91
  • Authentication Card

    Authentication Card

    52
  • Card Studio

    Card Studio

    47
  • Login Card

    Login Card

    35

Explore more

Part of Hirael — browse the full library on 21st.dev.