Skip to content

Slider - Web Component

...

Browser support

Parameters

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

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

NameTypeDescription
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

The events emitted from the component are:

NamePayloadDescription
onchangenumberReturns 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/slider.js"></script>
Code
html
<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ZDS | Link Web Component example</title>

    <!-- #region imports -->
    <link rel="stylesheet" href="/0.3.7/@zurich/web-components/styles.css" />
    <script type="module" src="/0.3.7/@zurich/web-components/slider.js"></script>
    <!-- #endregion imports -->

    <link rel="stylesheet" href="/0.3.7/examples/styles.css" />
    <script type="module" src="/0.3.7/examples/params-script.js"></script>
  </head>

  <body>

    <table>
      <tbody>
        <tr>
          <th>-</th>
          <td>
            <div>
              <z-slider label="Slider input" range='[0, 100]'>
              </z-slider>
            </div>
          </td>
        </tr>
        <tr>
          <th>with min and max</th>
          <td>
            <div>
              <z-slider label="Slider input" range='[0, 100]' show-min="0" show-max="100">
              </z-slider>
            </div>
          </td>
        </tr>
        <tr>
          <th>with icons</th>
          <td>
            <div>
              <z-slider label="Slider input" range='[0, 100]' icon-left="sound-off" icon-right="sound-on">
              </z-slider>
            </div>
          </td>
        </tr>
        <tr>
          <th>disabled</th>
          <td>
            <div>
              <z-slider label="Slider input" range='[0, 100]' disabled>
              </z-slider>
            </div>
          </td>
        </tr>
        <tr>
          <th>invalid</th>
          <td>
            <div>
              <z-slider label="Slider input" range='[0, 100]' invalid>
              </z-slider>
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </body>

</html>