Check Box
A Check Box or a selection box is a small interactive box toggled by the user to indicate an affirmative choice. It is used to select multiple options from several options.
Example
API Methods
setData
Sets the data in the particular array of objects.
- Method
- Usage
setData(data: checkBoxData[]): void
a8forms.Checkbox("checkboxId").setData([
{
id:1,
label: "Yes",
value: "yes",
},
{
id: 2,
label: "No",
value: "no",
},
]);
setLabel
Sets the label of the checkbox.
- Method
- Usage
setLabel(label: string): void
// Sets the field's label to 'Weather Report'
a8forms.Checkbox("checkboxId").setLabel('Weather Report')
setReadOnly
Sets the ReadOnly flag for this context. When in ReadOnly the user cannot be able to edit the content.
- Method
- Usage
setReadOnly(readOnly: boolean): void
//sets the field to ReadOnly not editable by the user
a8forms.Checkbox("checkboxId").setReadOnly(true)
// Sets the field to be active, editable by the user
a8forms.Checkbox("checkboxId").setReadOnly(false)
setRequired
Sets a field to be required or not.
- Method
- Usage
setRequired(required: boolean): void
// Sets the field as required
a8forms.Checkbox("checkboxId").setRequired(true)
// Sets the field as not required
a8forms.Checkbox("checkboxId").setRequired(false)
setSize
Sets the size only using the parameters passed in.
- Method
- Usage
setSize(size: "small" | "medium" | "large"): void
//Sets the size of the Checkbox to small
a8forms.Checkbox("checkboxId").setSize("small")
//Sets the size of the Checkbox to medium
a8forms.Checkbox("checkboxId").setSize("medium")
//Sets the size of the Checkbox to large
a8forms.Checkbox("checkboxId").setSize("large")
setVisibility
Sets the elements of the given category to visible in this view.
- Method
- Usage
setVisibility(visible: boolean): void
// setting the visibility true makes the element to visible
a8forms.Checkbox("checkboxId").setVisibility(true)
// setting the visibility false makes the element invisible
a8forms.Checkbox("checkboxId").setVisibility(false)
setVisibilityCondition
Sets the hide condition
- Method
- Usage
setVisibilityCondition(condition: string): void
// Hides the string
a8forms.Checkbox("checkboxId").setVisibilityCondition("1 == 1")