ArrayRadioInputs()function
ArrayRadioInputs({
value,
onValue,
required = false,
items,
formatter = formatValue,
...props
}: ArrayRadioInputsProps<T>): ReactElement| Param | Type | |
|---|---|---|
props | ArrayRadioInputsProps<T> | Props for ArrayRadioInputs, which renders a radio for each item in an array of values. required |
.items | ImmutableArray<T> | Array of values to show in the list of radios. required |
.formatter | ((value: T) => ReactNode) | Function that formats an obscure item into a ReactNode for display. |
| Return | |
|---|---|
ReactElement | Element rendering one radio per item plus an optional empty placeholder radio. |
Output a list of <RadioInput> elements for each item in an array.
- The items can be any type, and can be formatted for output through an optional
formatter()function. - A
placeholderoption is shown at the bottom ifrequired=false.
Examples
<ArrayRadioInputs name="size" items={["s", "m", "l"]} value={size} onValue={setSize} />