Phone Input
International phone number input with country selector dropdown, flag emojis, and dial codes. Features a searchable country list, auto-formatting, and a hidden input that stores the E.164 formatted value for form submission.
Preview & Code
_phone_input.html.erb
███
█████ █████ █████████ █████████
█████ ████████
███ ██████ █████████████████████████ █████ ███████ ██
█████ █████ ███████
███ ██████ █████████████████████████ █████ ████████ ██████ ██████ ████████ ████████████ ██████ █████████ ██
█████ ██████████ ███████ █████████
phone_input_controller.js
██████ █ ██████████ █ ████ ████████████████████
██████ ███████ █████ ███████ ██████████ █
██████ ███████ █ ██████████ ███████████ █████████ █████████████ ██████████████ ███████ ███████████ ██████████████
██████ ██████ █ █
████████ █ █████ ███████ ████████ ████ ██
█████ █ █████ ████████ ████████ █████ █
█
██████ █████████ █ █
phone_input_component.html.erb
████ ██████████ ███████████████ ███ ███ ████████████████████████████████████████ ███
██ ██ ███████████████ ██
██████ ████████ ██████████████ ███ ██████████ █████████████ ████
███ ██████ ██
██ ██ █████████ ██
█████ ███████████████████ ████████████████
██ ███ ██
████████
██ ███ ██
phone_input_component.rb
█ ██████████████████████ ████
█████ ███████████████████ █ ███████████████████
█████ █ █████ ██ ██████████
█████████ █ █
█ █████ █████ █████ ███████ ████████ █████ █████ █████ ████████████████████ ██
█ █████ █████ █████ ███████ █████████ █████ ██████ █████ ████████████████████ ██
█ █████ █████ █████ █████████ █████ █████ █████ ████████████████████ ██
█ █████ █████ █████ ████████████ █████ ██████ █████ ████████████████████ ██
phone_input_controller.js
██████ █ ██████████ █ ████ ████████████████████
██████ ███████ █████ ███████ ██████████ █
██████ ███████ █ ██████████ ███████████ █████████ █████████████ ██████████████ ███████ ███████████ ██████████████
██████ ██████ █ █
████████ █ █████ ███████ ████████ ████ ██
█████ █ █████ ████████ ████████ █████ █
█
██████ █████████ █ █
Changelog
- v1.0.0: Initial release with country selector, searchable dropdown, and E.164 hidden value
- 30 countries with flag emojis and dial codes
- Three size options: sm, md (default), lg
- Error and disabled states
- Full dark mode support
Get Full Access
Unlock the source code for this component and all others. One-time payment for lifetime access.
Get Access Now