Appearance
Function: radioList()
ts
function radioList(props: UiRadioListFieldProps): Element;Defined in: src/UI/blocks/radioList.tsx:64
Radio list component for single selection from multiple options.
Parameters
| Parameter | Type | Description |
|---|---|---|
props | UiRadioListFieldProps | Configuration object |
Returns
Element
Examples
Basic usage with required props
radioList({
name: 'gender',
label: 'Gender',
items: [
{ value: 'male', label: 'Male' },
{ value: 'female', label: 'Female' },
{ value: 'other', label: 'Other' }
]
});Usage with default value
radioList({
name: 'preferredContact',
label: 'Preferred Contact Method',
items: [
{ value: 'email', label: 'Email' },
{ value: 'phone', label: 'Phone' },
{ value: 'mail', label: 'Mail' }
],
defaultValue: 'email',
required: true,
disabled: false
});Usage with dynamic items depending on other fields
radioList({
name: 'food',
label: 'Food',
items: async ({data}) =>
data.country === 'us'
? [{value: 'burger', label: 'Burger'}, {value: 'fries', label: 'Fries'}]
: [{value: 'pasta', label: 'Pasta'}, {value: 'pizza', label: 'Pizza'}, {value: 'salad', label: 'Salad'}],
});