ArrayCheckboxInputscomponent

ArrayCheckboxInputs({
	value = [],
	onValue,
	required = false,
	items,
	formatter = formatValue,
	className,
	...props
}: ArrayCheckboxInputsProps<T>): ReactElement
ParamType
propsArrayCheckboxInputsProps<T>
Props for ArrayCheckboxInputs, which renders a checkbox for each item in an array of values. required
    .itemsImmutableArray<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 items stay 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} />