Radio is a round interactive element that allows the user to choose only one option from a predefined set of mutually exclusive choices. Radio buttons must be organised into groups of at least 2 entries identified by their common name as they function as interdependent boolean flags. Checking one radiobutton in a group automatically uncheckes all others.
js const my_radio = mapp.ui.elements.radio({ label: "My only option" });
In order to create radio buttons as a group:
const my_radio1 = mapp.ui.elements.radio({ label: "My option 1", name: "my_group" });
const my_radio2 = mapp.ui.elements.radio({ label: "My option 2", name: "my_group" });
const my_radio3 = mapp.ui.elements.radio({ label: "My option 3", name: "my_group" });
Name | Type | Description |
---|---|---|
params | Object | Configuration object |
Name | Type | Attributes | Description |
---|---|---|---|
params.name | String | <optional> | name attribute which identifies the group and links radio buttons as members. |
params.data_id | String | <optional> | Data attribute which identifies each member within the group |
params.label | String | <optional> | Text label to display next to radio button |
params.caption | String | <optional> | Text caption to display before the radio button |
params.onchange | function | <optional> | Function to execute after the checked state within the group is changed. It takes change event and configuration params as arguments. |
- Source
- Type:
- HTMLElement