Free, open-source phone input component for shadcn-ui
Built with React, TypeScript, Tailwind CSS, shadcn-ui, and libphonenumber-js
Features country selection with flags and robust phone number validation
Integrates via shadcn CLI for Next.js/React projects
MIT-licensed
Shadcn Phone is a free, open-source React component by Damian Ricobelli, designed to extend shadcn-ui with a customizable phone input field. It’s ideal for developers building forms for user registration, profiles, or contact pages in Next.js or React applications, particularly those using shadcn-ui.
Built with React, TypeScript, Tailwind CSS, shadcn-ui, and libphonenumber-js, it offers country selection with flag icons, accurate phone number validation, and seamless integration via shadcn CLI. Announced on X, it addresses the community’s need for a shadcn-ui-compatible phone input, providing a polished and accessible solution.
Country Selection: Dropdown with country flags and calling codes for global compatibility.
Phone Number Validation: Uses libphonenumber-js for reliable, country-specific validation.
Accessible Design: Inherits shadcn-ui’s WAI-ARIA compliance for accessibility.
CLI Integration: Install via shadcn CLI for quick setup in shadcn-ui projects.
Responsive Styling: Tailwind CSS ensures adaptability across devices.
Form Integration: Compatible with react-hook-form and Zod for type-safe forms.
Utility Function: getPhoneData provides details like country code, national number, and validity.
Seamless shadcn-ui Fit: Matches shadcn-ui’s aesthetic and accessibility standards.
Free and Open-Source: MIT license allows unrestricted use and customization.
Robust Validation: libphonenumber-js ensures accurate phone number validation.
Easy Setup: CLI simplifies integration into shadcn-ui projects.
Community-Driven: Responds to user demand for phone input solutions.
React Dependency: Limited to React/shadcn-ui ecosystems.
Setup Requirements: Needs shadcn-ui, Tailwind CSS, and libphonenumber-js installed.
Client-Side Focus: Validation is client-side; server-side requires additional setup with libphonenumber-js.
Niche Scope: Focused solely on phone input, not a broader component library.
PhoneInput: Main component with country selection, flag display, and validation.
CountrySelect: Dropdown for selecting countries with flags.
FlagComponent: Renders country flags for visual feedback.
Shadcn Phone is completely free under the MIT license, with no premium tiers.
React: Core framework for the component.
shadcn-ui: Provides accessible, styled primitives.
Tailwind CSS: Utility-first styling for responsive design.
Next.js: Optimized for Next.js projects.
TypeScript: Ensures type safety.
libphonenumber-js: Powers phone number validation and formatting.
react-hook-form & Zod: Supports type-safe form integration.
A customizable phone input component for shadcn-ui with country selection and validation using libphonenumber-js.
Yes, it’s fully free under the MIT license.
It’s designed for shadcn-ui; non-shadcn-ui use requires replacing dependencies.
Simple and formatted phone input component built with Shadcn UI.
Submit your Shadcn product to AllShadcn, get featured, and drive genuine traffic while showcasing your work to the world. Turn your creativity into revenue and begin selling today! 🚀