Skip to content

Checkbox - Web Component

...

Browser support

Parameters

The Web component uses a <z-checkbox> tag.

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescription
configstring?...
label
(optional)
stringLabel of the input
value
(optional)
booleanValue of the model
checked
(optional)
booleanOverrides the "value" parameter as in the standard
disabled
(optional)
booleanBlocks the interaction with the input component.
required
(optional)
booleanMarks the input component as required.
name
(optional)
stringIdentification for the field inside the form
invalid
(optional)
booleanThe forced state for set the input as invalid
indeterminatebooleanMarks the component as indeterminate.

The events emitted from the component are:

NamePayloadDescription
onchangebooleanReturns the new value of the "value" attribute

Playground

Customization

HTML Examples

Imports
html
<link rel="stylesheet" href="/0.3.7/@zurich/web-components/styles.css" />
<script type="module" src="/0.3.7/@zurich/web-components/checkbox.js"></script>
Code
html
<z-checkbox></z-checkbox>
<z-checkbox disabled></z-checkbox>
<z-checkbox invalid-text="Invalid input"></z-checkbox>

<z-checkbox checked></z-checkbox>
<z-checkbox checked disabled></z-checkbox>
<z-checkbox checked invalid-text="Invalid input"></z-checkbox>

<z-checkbox label="Checkbox"></z-checkbox>
<z-checkbox label="Checkbox" disabled></z-checkbox>
<z-checkbox label="Checkbox" invalid-text="Invalid input"></z-checkbox>

<z-checkbox label="Checkbox" checked></z-checkbox>
<z-checkbox label="Checkbox" checked disabled></z-checkbox>
<z-checkbox label="Checkbox" checked invalid-text="Invalid input"></z-checkbox>