Skip to main content

Radio Button

The Radio button component can be used to collect user input from a list of options.

Data

Property
Description
Expected Value
LabelText to display as the label for the component.String (e.g., Select an option).

Options

Allows you to add options to the radio button field. You can click on Add new option button and add options manually or enable Dynamic options and enter the options using code.

Example Code for Dynamic Options

  1. Passing an array of objects and specifying each value:
{
{
[
{
label: "option1",
value: 1,
disable: false,
visible: true,
default: true,
},
{ label: "option2", value: 2, disable: false, visible: true },
{ label: "option3", value: 3, disable: false, visible: true },
];
}
}
  1. Passing an array of objects with a default value from a Table component's selected row:
{
{
queries.getEmployees.data.map((option) => ({
label: option.firstname,
value: option.firstname,
disable: false,
visible: true,
default: option.firstname === components.table1.selectedRow.firstname,
}));
}
}

Layout

Controls how the radio button options are arranged within the component.

Value
Description
RowOptions are arranged horizontally in a single row.
ColumnOptions are stacked vertically in a single column.
WrapOptions are arranged horizontally and wrap to the next line when they exceed the available width.

Options loading state

Allows you to add a loading state to the dynamically generated options. You can enable or disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.

Component Specific Actions (CSA)

The following actions of the component can be controlled using the component-specific actions (CSA), you can trigger it using an event or use a RunJS query.

Actions
Description
How To Access
selectOption()Selects an option.components.radiobutton1.selectOption(2)
deselectOption()Deselects the selected option.components.radiobutton1.deselectOption()
setVisibility()Sets the visibility of the component.components.radiobutton1.setVisibility(false)
setLoading()Sets the loading state of the component.components.radiobutton1.setLoading(true)
setDisable()Disables the component.components.radiobutton1.setDisable(true)

Exposed Variables

Variable
Description
How To Access
labelHolds the label name of the radio button.{{components.radiobutton1.label}}
valueHolds the value selected by the user in the component.{{components.radiobutton1.value}}
optionsHolds all the option values of the radio button in array form.{{components.radiobutton1.options}} or
{{components.radiobutton1.options[0].label}}
isValidIndicates if the input meets validation criteria.{{components.radiobutton1.isValid}}
isMandatoryIndicates if the field is required.{{components.radiobutton1.isMandatory}}
isLoadingIndicates if the component is loading.{{components.radiobutton1.isLoading}}
isVisibleIndicates if the component is visible.{{components.radiobutton1.isVisible}}
isDisabledIndicates if the component is disabled.{{components.radiobutton1.isDisabled}}

Events

Event
Description
On selectTriggers whenever an option is selected.
info

Check Action Reference docs to get detailed information about all the Actions.

Validation

Validation Option
Description
Expected Value
Make this field mandatoryDisplays a 'Field cannot be empty' message if no option is selected.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Custom validationSpecifies a validation error message for specific conditions.Logical Expression (e.g., {{!components.radiobutton1.value && "Please select an option"}}).

Additional Actions

Action
Description
Configuration Options
Loading stateEnables a loading spinner, often used with isLoading to indicate progress.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
VisibilityControls component visibility.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Collapse when hiddenCollapses the component's space when hidden, so surrounding components fill the space.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
DisableEnables or disables the component.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
TooltipDisplays an informational tooltip when the user hovers over the component.String (e.g., Select an option).

Devices

Property
Description
Expected Value
Show on desktopMakes the component visible in desktop view.You can set it with the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Show on mobileMakes the component visible in mobile view.You can set it with the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.

Styles

Label

Label Property
Description
Configuration Options
ColorSets the color of the component's label.Select the color or click on fx and input code that programmatically returns a Hex color code.
AlignmentSets the position of the label relative to the options.Click on the toggle options or click on fx to input code that programmatically returns an alignment value — side or top.
DirectionWhen alignment is set to side, controls whether the label appears to the left or right of the options.Select Left or Right using the icon toggles.
WidthSets the width of the label. Available when alignment is side.Enable Auto to use the standard width automatically, or disable it to manually set the width using the slider or fx. You can also choose whether the width is calculated relative to the Container or the Field.

Switch

Field Property
Description
Configuration Options
BorderSets the border color of the radio buttons.Select the color or click on fx and input code that programmatically returns a Hex color code.
Checked backgroundSets the background color of the selected radio button.Select the color or click on fx and input code that programmatically returns a Hex color code.
Unchecked backgroundSets the background color of unselected radio buttons.Select the color or click on fx and input code that programmatically returns a Hex color code.
Handle colorSets the fill color of the selected radio button's indicator dot.Select the color or click on fx and input code that programmatically returns a Hex color code.
TextSets the color of the option labels.Select the color or click on fx and input code that programmatically returns a Hex color code.

Container

Padding
Allows you to maintain a standard padding by enabling the Default option.