Skip to content

Description

Field.PhoneNumber is a wrapper component for the input of strings, with user experience tailored for phone number values.

import { Field } from '@dnb/eufemia/extensions/forms'
render(<Field.PhoneNumber />)

There is a corresponding Value.PhoneNumber component.

Value

This component behaves as "one single component". Therefor it combines the country code and the number to a single string during an event callback.

Also, the value property should be a string with the country code, separated from the main number by a space.

The component returns the emptyValue when no number is set, which defaults to undefined.

Default country code

The default country code is set to +47.

Structure and format of phone numbers

Creating a list of all possible phone numbers would be impractical due to the vast number of combinations, especially considering the various country codes, area codes, and local numbers. Additionally, new numbers are constantly being allocated, and existing numbers may be reassigned over time.

Therefore, the structure and format is only used when +47 is selected.