renderRadioGroup
renderRadioGroup<
V>(args):ReactElement
Defined in: RadioGroupBinding.ts:143
Render a radio button for each option of a radio group
Type Parameters
Section titled “Type Parameters”V extends RadioGroupBinding.Option
Parameters
Section titled “Parameters”binding
Section titled “binding”(option: V, config?: RadioGroupBinding.ButtonConfig) => object
What form.bindRadioGroup() returns
options
Section titled “options”readonly V[]
Options to render a radio button for, in order
renderOption
Section titled “renderOption”(option: V, bind: (config?: RadioGroupBinding.ButtonConfig) => object, index: number) => ReactNode
Render the radio button of an option
Returns
Section titled “Returns”ReactElement
Remarks
Section titled “Remarks”renderOptionreceives the option, abindfunction that returns the props of the option's radio button, and the option's index.bindtakes the same overrides as the binding's second argument.- Each option is keyed by its value, so the element that
renderOptionreturns needs nokey.
Example
Section titled “Example”{renderRadioGroup({ binding: form.bindRadioGroup("role", { getter: () => model.role, setter: (v) => (model.role = v), }), options: Object.values(Role), renderOption: (role, bind) => ( <label> <input {...bind()} /> {role} </label> ),})}