Overview #
The PhoneInput is a form component for entering phone numbers with country code selection. It automatically applies country-specific formatting based on the selected country. Flutter uses
PhoneInput while Web uses PhoneInput.
Flutter (coui_flutter) #
Import #
import 'package:coui_flutter/coui_flutter.dart' ;
PhoneInput (
value: phoneNumber,
onChanged: handlePhoneChanged,
defaultCountry: 'KR' ,
)
With Dial Code Display and Validation #
PhoneInput (
value: phoneNumber,
onChanged: handlePhoneChanged,
defaultCountry: 'KR' ,
showDialCode: true ,
validator: ( value) {
if ( value == null || value. isEmpty) return 'ě íë˛í¸ëĽź ě
ë Ľíě¸ě' ;
return null ;
} ,
)
With Country Restrictions #
PhoneInput (
value: phoneNumber,
onChanged: handlePhoneChanged,
countries: [ 'KR' , 'US' , 'JP' , 'CN' ] ,
defaultCountry: 'KR' ,
)
Parameters #
Parameter Type Default Description
value
String?
null
Current phone number value
onChanged
ValueChanged<String>?
null
Change callback handler
defaultCountry
String
'KR'
Default country code (ISO 3166-1)
countries
List<String>?
null
Allowed countries list; null permits all
showDialCode
bool
true
Display country dial code
validator
String? Function(String?)?
null
Validation function
enabled
bool
true
Enable/disable state
Web (coui_web) #
Import #
import 'package:coui_web/coui_web.dart' ;
PhoneInput (
value: phoneNumber,
onChanged: handlePhoneChanged,
defaultCountry: 'KR' ,
)
With Multiple Countries #
PhoneInput (
value: phoneNumber,
onChanged: handlePhoneChanged,
defaultCountry: 'KR' ,
showDialCode: true ,
countries: [ 'KR' , 'US' , 'JP' ] ,
)
Common Patterns #
Variants #
Domestic Only : countries: ['KR'] with defaultCountry: 'KR'
International : showDialCode: true with multiple country options
Concept Flutter Web
Component PhoneInputPhoneInput
API structure Identical Identical