Skip to content

Import

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

Description

Field.ArraySelection is a component for selecting between a fixed set of options using checkboxes or similar, that will produce a value in the form of an array containing the values of selected options.

Uses the Field.Option pseudo-component to define options.

There is a corresponding Value.ArraySelection component.

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

You can also use the dataPath property to provide the data to the component:

import { Field } from '@dnb/eufemia/extensions/forms'
render(
<Form.Handler
data={{
myDataPath: [
{ title: 'Foo!', value: 'foo' },
{ title: 'Bar!', value: 'bar' },
],
}}
>
<Field.ArraySelection dataPath="/myDataPath" />
</Form.Handler>,
)

Relevant links