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 PhoneInputFormDemo() {
const [sent, setSent] = React.useState("");
return (
<form
className="grid w-full max-w-sm items-start gap-3"
onSubmit={(e) => {
e.preventDefault();
setSent(String(new FormData(e.currentTarget).get("phone")));
}}
>
<PhoneInput
label="Phone for the reading room"
name="phone"
country="TR"
required
className="w-full"
/>
<button
type="submit"
className="inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground"
>
Book a desk
</button>
<p role="status" className="text-sm text-muted-foreground tabular-nums">
{sent ? `Would send phone=${sent}` : ""}
</p>
</form>
);
}
















