ArrayCheckboxInputscomponent
ArrayCheckboxInputs({
value = [],
onValue,
required = false,
items,
formatter = formatValue,
className,
...props
}: ArrayCheckboxInputsProps<T>): ReactElement| Param | Type | |
|---|---|---|
props | ArrayCheckboxInputsProps<T> | Props for ArrayCheckboxInputs, which renders a checkbox for each item in an array of values. required |
.items | ImmutableArray<T> | Array of values to show in the list of checkboxes. required |
.formatter | ((value: T) => ReactNode) | Function that formats an obscure item into a ReactNode for display. |
| Return | |
|---|---|
ReactElement | Element rendering one checkbox per item. |
Output a list of <CheckboxInput> elements for each item in an array, to pick any number of them.
- The value is the array of checked items, in the order they were checked. Items are compared with
===. - Checked items that are not in
itemsstay in the value. - The items can be any type, and can be formatted for output through an optional
formatter()function.
Examples
<ArrayCheckboxInputs name="sizes" items={["s", "m", "l"]} value={sizes} onValue={setSizes} />