Skip to content

Switch - Web Component

...

Browser support

Parameters

The Web component uses a <z-switch> 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

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/switch.js"></script>
Code
html
<!-- Default -->
<z-switch checked></z-switch>
<z-switch checked label="Switch"></z-switch>

<!-- Disabled -->
<z-switch disabled checked></z-switch>
<z-switch disabled checked label="Switch"></z-switch>

<!-- Invalid -->
<z-switch invalid-text="Invalid input" checked></z-switch>
<z-switch invalid-text="Invalid input" checked label="Switch"></z-switch>