RadioGroup
Presents a single choice as rows or descriptive cards.
When to use
- Show every option when users need to compare them before choosing.
Examples
Two delivery options
Loading the example
<k:RadioGroup label="Delivery method" selectedKey="pickup" change=".onChange">
<k:RadioItem key="pickup" text="Pickup"/>
<k:RadioItem key="carrier" text="Carrier"/>
</k:RadioGroup>sap.ui.define(["sap/ui/core/mvc/Controller", "kor/ui/Toast"], (Controller, Toast) => Controller.extend("sample.RadioGroupChange", {
onChange(event) {
Toast.show(event.getParameter("key") === "pickup" ? "Pickup selected" : "Carrier selected");
}
}));Compare delivery details
Loading the example
<k:RadioGroup label="Dispatch method" cards="true" selectedKey="pickup" change=".onChange">
<k:RadioItem key="pickup" icon="boxes" text="Warehouse pickup" help="Collect it from the east entrance."/>
<k:RadioItem key="carrier" icon="truck" text="Carrier delivery" help="Delivery takes two working days."/>
</k:RadioGroup>sap.ui.define(["sap/ui/core/mvc/Controller", "kor/ui/Toast"], (Controller, Toast) => Controller.extend("sample.RadioGroupChange", {
onChange(event) {
Toast.show(event.getParameter("key") === "pickup" ? "Pickup selected" : "Carrier selected");
}
}));API
Properties
| Name | Type | Default | Description |
|---|---|---|---|
selectedKey | string | Key of the selected option | |
label | string | Group label | |
cards | boolean | false | Whether to show options as cards |
error | string | Validation message | |
required | boolean | false | Whether a selection is required |
enabled | boolean | true | Whether the group can be used |
Aggregations
| Name | Type | Description |
|---|---|---|
items | RadioItem[] | Available choices |
Events
| Name | Type | Description |
|---|---|---|
change | key: string | Selection changed |
RadioItem
An option in a radio group.
Properties
| Name | Type | Default | Description |
|---|---|---|---|
key | string | Option key | |
text | string | Option text | |
help | string | Supporting text | |
icon | string | Icon name |