Skip to content

Import

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

Description

Value.SelectCountry will render the selected country name by value's ISO code (ISO 3166-1 alpha-2 code). It displays the country name in the current locale. If the value provided is not a valid/supported ISO code, it displays the value.

There is a corresponding Field.SelectCountry component.

import { Value } from '@dnb/eufemia/extensions/forms'
render(<Value.SelectCountry path="/country" />)

Relevant links

The useCountry hook

You can use the Value.SelectCountry.useCountry hook to get the country name by ISO code (ISO 3166-1 alpha-2 code). It returns the country name in the current locale.

import { Value } from '@dnb/eufemia/extensions/forms'
const MyComponent = () => {
const { getCountryNameByIso } = Value.SelectCountry.useCountry('NO')
}