A polished phone-number input component built with React and Hero UI. Supports international formats, validation, and type inference for seamless integration into form workflows.
A modern, accessible, and feature-rich international telephone input component built with React and HeroUI. Perfect for forms that require phone number input with country selection.
✨ Features
🌍 International Support: Supports all countries with their respective calling codes
🎨 HeroUI Integration: Built on top of HeroUI for consistent design and theming
📱 Smart Formatting: Automatic phone number formatting based on country
🔍 Country Search: Easy country selection with search functionality
🚀 TypeScript: Full TypeScript support with comprehensive type definitions
♿ Accessible: WCAG compliant with proper ARIA attributes
🎯 Form Integration: Works seamlessly with React Hook Form and other form libraries
🔧 Customizable: Extensive customization options for flags, styling, and behavior
📦 Lightweight: Minimal bundle size with tree-shaking support
📦 Installation
npminstall @hyperse/hero-tel-input
# oryarnadd @hyperse/hero-tel-input
# or
🚀 Quick Start
📖 Basic Usage
Simple Implementation
With React Hook Form
🎛️ API Reference
Props
Prop
Type
Default
Description
value
string
''
The phone number value
defaultCountry
HeroTelInputCountry
-
Default country to select
forceCallingCode
boolean
false
Force the calling code to be included
onlyCountries
HeroTelInputCountry[]
-
Only allow these countries
excludedCountries
HeroTelInputCountry[]
HeroTelInputInfo
🎨 Advanced Examples
Custom Country Filtering
Force Calling Code
Custom Styling
Form Validation
🌍 Supported Countries
The component supports all countries with their respective calling codes. You can:
Filter by specific countries using onlyCountries
Exclude countries using excludedCountries
Set preferred countries using preferredCountries
Filter by continents using continents
Available Continents
'AF' - Africa
'AS' - Asia
'EU' - Europe
'NA' - North America
'OC' - Oceania
'SA' - South America
Examples
Check out the examples in the examples/ directory:
example-nextjs/ - Next.js integration example
website/ - Documentation website
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.