ebnsina

Phone Input

Forms

About

A phone number form field that lets you pick or search a country, auto-formats the number as you type, follows a pasted international number to the right country, and shows a plain-language validity message.

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 React from "react";
import PhoneInput from "@/components/ui/phone-input";

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

  return (
    <div className="w-full max-w-sm">
      <PhoneInput
        label="Phone"
        country="BD"
        preferred={["BD", "MY", "SA", "TR"]}
        hint="We'll text you when your manuscript is ready to collect."
        value={value}
        onValueChange={setValue}
      />
      <p className="mt-3 text-sm text-muted-foreground tabular-nums">
        {value ? `Saved as ${value}` : "Nothing saved yet"}
      </p>
    </div>
  );
}

Dependencies

More by ebnsina

View all
  • Countdown Timer

    Countdown Timer

    35
  • Video Player

    Video Player

    26
  • Alarm Clock

    Alarm Clock

    24
  • Hourglass Timer

    Hourglass Timer

    19
  • Voice Note

    Voice Note

    19
  • Sortable List

    Sortable List

    18
  • Sign In Auth Card

    Sign In Auth Card

    14
  • Split Button

    Split Button

    13

More in Forms

View all
  • Premium Auth

    Premium Auth

    577
  • Login 1

    Login 1

    68
  • Contact Card

    Contact Card

    1.1K
  • Form

    Form

    18
  • Login Card

    Login Card

    36
  • Login 2

    Login 2

    15
  • Change Password Form

    Change Password Form

    11
  • Form

    Form

    3