Radio group
Last updated
Last updated
The Radio group
component allows for the selection of a single value from a list of options. The options are presented as radio buttons, which have a value and a label. Like inputs, switches and selects, the Radio group
fits well into the context of a Form
.
The Radio group
component offers the following configuration properties.
Property | Type | Default value | Behavior |
---|---|---|---|
Default value |
|
| Determines which radio button will be selected by default at first render. This value is also used when the |
Disabled |
|
| Whether the input should be disabled or not. When disabled, the input is greyed out and values cannot be toggled. |
Label position |
|
| Determines whether the labels of the radio buttons are on the left or the right. |
Labels |
|
| Labels to be rendered for each option. In case there are more "Labels" than "Values", the redundant labels are ignored. If there are more "Values" than "Labels", the additional values are rendered with their raw value. |
Text alignment |
|
| Alignment of the radio button labels and the "Title" text. There is no way to set these alignments separately. |
Title |
|
| The text rendered above the radio button inputs. Does not create unnecessary whitespace when left empty. |
Toggle with label |
|
| By default, the radio buttons can only be selected when clicking directly on the input. When this property is set to |
Values |
|
| Array of internal values of the options. Its length determines how many radio options are rendered. Non-string elements of the array are ignored. |
The Radio group
offers only a single event "On change". This event is triggered whenever the selected option is changed by the user. Programmatically changing the value by using the reset()
or setValue(value)
functions does not trigger this event.
The Radio group
exposes the following API in the JavaScript runtime environment.
Property / Function | Type | Behavior |
---|---|---|
|
| Current boolean value of the "Disabled" property. |
|
| Provides the current value of the "Labels" property. If the number of values and labels is not equal, the unpruned array will be returned, even if not all labels are used. |
|
| Resets the radio group similar to the current value of the "Default value" property. This is especially useful when a |
|
| Sets the value of the "Disabled" property to the provided boolean value. |
|
| Sets the value of the "Labels" property to the provided strings array. |
|
| Sets the "Title" property to the provided string value. |
|
| Sets the option values to the provided string array. |
|
| Provides the current string value of the "Text" property. |
|
| Value of the currently selected radio button. Should always be a member of the array returned by |
|
| Current value of the "Values" property. |