Segmented control - Web Component
Browser support
Detected engine:
Chromium
Webkit
Gecko
Parameters
The Web component uses the <z-segmented-control>
tag:
The parametrization of the component can be done with the following custom HTML params:
Name | Type | Description |
---|---|---|
options | object[] | Array of options to be displayed |
name (optional) | string | Name of the input |
disabled (optional) | boolean | Blocks user interaction with the component |
The events emitted from the component are:
Name | Payload | Description |
---|---|---|
onchange | string | Returns the new value of the "value" attribute |
options
The options
parameter is used to set the options of the segmented control. Each option object should contain the text
and value
keys, also the disabled
key is optional.
name
The name
parameter is used to set the name of the segmented control.
disabled
The disabled
parameter is used to block the interaction with the component.
Playground
Customization
HTML Examples
Imports
html
<link rel="stylesheet" href="/0.5.0/@zurich/web-components/styles.css" />
<script type="module" src="/0.5.0/@zurich/web-components/segmented-control.js"></script>
Code
html
<!-- Default -->
<z-segmented-control name="segmented-control-2" value="1"
options='[{"text":"Text 1"}, {"text":"Text 2"}]'></z-segmented-control>
<!-- icon -->
<z-segmented-control name="segmented-control-2i" value="1"
options='[{"icon":"bar-chart:line"}, {"icon":"bar-chart:line"}]'></z-segmented-control>
<!-- combined -->
<z-segmented-control name="segmented-control-2c" value="1"
options='[{"icon":"bar-chart:line"}, {"icon":"bar-chart:line","text":"Text 1"}]'></z-segmented-control>
<!-- disabled -->
<z-segmented-control name="segmented-control-2d" value="1" disabled
options='[{"text":"Text 1"}, {"text":"Text 2"}]'></z-segmented-control>