Skip to main content
Neural UIv2.1.0Documentation
View v1

Phone Input

Enter a telephone number with a country picker and an international result.

Category
Forms and selection
Import
@neural-ui/core/phone-input
Selector
neu-phone-input
import { NeuPhoneInputComponent } from '@neural-ui/core/phone-input';

Overview

Phone Input combines a searchable country field and a telephone input. The value keeps the original text and includes an E.164 number when the text can be normalized.

Enter an international number

With Spain selected, enter 612 345 678 and compare the entered text with +34612345678. Change the country or prefix to explore other numbers.

Enter an international number
Phone number
As entered
โ€”
International format
โ€”
Field statesTouched ยท No
View form value
null

Configurator

Choose the default country and compare read only, disabled and required states.

Configurator

Live preview

Telephone number
International format ยท โ€”
template.html
<neu-phone-input [label]="label()" [defaultRegion]="defaultRegion()" [(value)]="value" [readonly]="readonly()" [disabled]="disabled()" [required]="required()" />

State and events

Bind value as a model. Keep the E.164 field when your application needs a canonical number and retain the entered text where appropriate.

Accessibility and keyboard

The examples use visible labels and follow the focus order of the live controls.

Key
Action
Tab Move between country selection and the number field.
Arrow Down Open the country options and navigate through them.
Enter Select the highlighted country.
Escape Close the country selector.

API

Set the default region and bind the parsed phone value, with support for field states.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
defaultRegionimport("libphonenumber-js/max").CountryCode'US'[defaultRegion]Country used when initially entering a local number.
disabledbooleanfalse[disabled]Prevent country and number changes.
errorMessagestring''[errorMessage]Fallback message for an invalid field.
errorsreadonly ValidationError.WithOptionalFieldTree[][][errors]Validation errors supplied by the form.
hiddenbooleanfalse[hidden]Hide the telephone control.
hintstring''[hint]Help text associated with the control.
invalidbooleanfalse[invalid]Marks the control as invalid.
labelstring''[label]Visible label for the field.
namestring''[name]Form name for the telephone field.
readonlybooleanfalse[readonly]Show country and phone number without allowing edits.
requiredbooleanfalse[required]Expose the required state.

Models

A model supports [(property)]="signal" or the [property] and (propertyChange) pair. Choose one form, not both.

Name
Type
Default
Template binding
Description
valueNeuPhoneInputValue | nullnull[(value)]Entered phone value and its normalized result, or null for an empty field.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
touchvoid(touch)="onTouch($event)"Emits after focus leaves the composite control.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

This component does not expose content projection or public customization templates.

Public Types

Open a type to inspect its definition and interface fields.

Theming

The country selector and telephone input use the Neural form controls and their shared theme.

Specific tokens

This component uses shared theme tokens rather than dedicated component hooks.

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
No data