Radio Button
Radio buttons are normally presented in radio groups (a collection of radio buttons describing a set of related options). Only one radio button in a group can be selected at the same time.
Example
API Methods
setLabel
Sets the label of the field.
- Method
- Usage
setLabel(label: string): void
// Sets the field's label to 'My Text'
a8forms.RadioButton("radiobutton").setLabel('My Text')
setData
Sets the data in a particular array of objects.
- Method
- Usage
setData(data: RadioButtonData[]): void
a8forms.RadioButton("radioButtonId").setData([
{
label: "Yes",
value: "yes",
id: 123,
},
{
label: "No",
value: "no",
id: 123,
},
]);
setReadOnly
Sets the ReadOnly flag for this context.
- Method
- Usage
setReadOnly(readOnly: boolean): void
// Sets the field to read only, not editable by the user
a8forms.RadioButton("radioButtonId").setReadOnly(true);
// Sets the field to read only, editable by the user
a8forms.RadioButton("radioButtonId").setReadOnly(false);
setRequired
Sets a field to be required or not.
- Method
- Usage
setRequired(required: boolean): void
// Sets the field as required
a8forms.RadioButton("radioButtonId").setRequired(true)
// Sets the field as not required
a8forms.RadioButton("radioButtonId").setRequired(false)
setSize
Sets the size only using the parameters passed in.
- Method
- Usage
setSize(size: "small" | "medium" | "large"): void
//Sets the size to small
a8forms.RadioButton("radioButtonId").setSize("small")
//Sets the size to medium
a8forms.RadioButton("radioButtonId").setSize("medium")
//Sets the size to large
a8forms.RadioButton("radioButtonId").setSize("large")
setVisibility
Sets if elements of the given category is visible in this view.
- Method
- Usage
setVisibility(visible: boolean): void
// setting the visibility true makes the element to visible
a8forms.RadioButton("radioButtonId").setVisibility(true)
// setting the visibility false makes the element to not visible
a8forms.RadioButton("radioButtonId").setVisibility(false)
setVisibilityCondition
Sets the hide condition
- Method
- Usage
setVisibilityCondition(condition: string): void
// Hides the string
a8forms.RadioButton("radiobuttonId").setVisibilityCondition("1 == 1");