Description
Field.SelectCountry
is a wrapper component for the select component, with options built in for selecting a country.
import { Field } from '@dnb/eufemia/extensions/forms'render(<Field.SelectCountry />)
Demos
Empty
Code Editor
<Field.SelectCountryonChange={(value) => console.log('onChange', value)}/>
Placeholder
Code Editor
<Field.SelectCountryplaceholder="Select something...."onChange={(value) => console.log('onChange', value)}/>
Label
Code Editor
<Field.SelectCountrylabel="Label text"onChange={(value) => console.log('onChange', value)}/>
Option selected
Code Editor
<Field.SelectCountryvalue="bar"onChange={(value) => console.log('onChange', value)}/>
Label and option selected
Code Editor
<Field.SelectCountryvalue="bar"label="Label text"onChange={(value) => console.log('onChange', value)}/>
With help
Code Editor
<Field.SelectCountryvalue="bar"label="Label text"help={{title: 'Help is available',contents:'Helping others, encouraging others, are often acts of being kind that have more meaning that you may realize.',}}onChange={(value) => console.log('onChange', value)}/>
Disabled
Code Editor
<Field.SelectCountryvalue="bar"label="Label text"onChange={(value) => console.log('onChange', value)}disabled/>
Error
Code Editor
<Field.SelectCountryvalue="bar"label="Label text"onChange={(value) => console.log('onChange', value)}error={new FormError('This is what is wrong...')}/>
Validation - Required
Code Editor
<Field.SelectCountrylabel="Label text"onChange={(value) => console.log('onChange', value)}requiredvalidateInitiallyvalidateUnchanged/>