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" });
Parameters:
NameTypeDescription
paramsObject

Configuration object

Properties
NameTypeAttributesDescription
params.nameString<optional>

name attribute which identifies the group and links radio buttons as members.

params.data_idString<optional>

Data attribute which identifies each member within the group

params.labelString<optional>

Text label to display next to radio button

params.captionString<optional>

Text caption to display before the radio button

params.onchangefunction<optional>

Function to execute after the checked state within the group is changed. It takes change event and configuration params as arguments.

Returns:
Type: 
HTMLElement