Skip to content

Checkbox

Checkbox components are Control Fields that allow the user to enter boolean chains.

checkbox.json
{
"form": {
"uid": "",
"kind": "layout",
"widget": "stack",
"children": [
{
"uid": "",
"kind": "control",
"widget": "checkbox",
"path": "createUser",
"label": "Create a new user?"
}
]
}
}

Use this props to customize your Checkbox component.

proptypevalue
checkboxPositionstringThe checkbox position, possible values are right or left

Use the property checkboxPosition to add align the checkbox input to left or right.

checkbox.json
{
"form": {
"uid": "",
"kind": "layout",
"widget": "stack",
"children": [
{
"uid": "",
"kind": "control",
"widget": "checkbox",
"path": "acceptConditions",
"label": "Yes, I have read terms and conditions",
"props": {
"checkboxPosition": "left"
}
}
]
}
}

Checkboxes can be styled as explained in the Styling Guide.

Following you will find a list with the CSS Variables and a quick description of what you will style.

CSS VariableDescription
--gui-color-borderInput border color
--gui-checkbox-radiusCheckbox radius
--gui-color-primaryAccent color and box shadow color

This is the anatomy of the Checkbox Component in case you want to use your CSS styles.

checkbox.html
<gui-checkbox class="gui-checkbox gui-checkbox--left">
<label for="fieldUid">Label</label>
<div class="gui-field gui-field--horizontal">
<input
type="checkbox"
id="fieldUid"
checked
disabled
aria-readonly="true"
aria-required="true"
aria-checked="false"
/>
</div>
</gui-checkbox>