Seekbar 2.0 implementation

This article gives you all you need to implement a v2.0 Gaia seekbar in your own app.

Live sample

The following gives you an idea of what rendered seekbars would look like.

Code

Here is the code you'll need.

CSS

<link href="(your styles folder)/style/seekbars.css" rel="stylesheet" type="text/css">

The CSS can be found in the Gaia project 2.0 branch under shared/style/seekbars.css. Copy this into your own project, along with the associated resources.

HTML

Note: The CSS inside the <style> element isn't needed for the implementation: it is just for the purposes of this example.

<!doctype html>
<html>
<head>
  <link href="https://mdn.github.io/gaia-2.0-bb/seekbars.css" rel="stylesheet" type="text/css">
  <link href="https://gaia-components.github.io/gaia-icons/gaia-icons-embedded.css" rel="stylesheet" type="text/css">
  <style>
    html, body {
      margin: 0;
      padding: 0;
      font-size: 10px;
    }

    body {
      background: #fff;
    }

    h2.bb-docs {
      font-size: 1.8rem;
      font-family: sans-serif;
      font-weight: lighter;
      color: #666;
      margin: -1px 0 0;
      background-color: #f5f5f5;
      padding: 0.4rem 0.4rem 0.4rem 3rem;
      border: solid 1px #e8e8e8;
    }

    body[role="application"] section {
      background: #fff;
      padding: 2rem;
    }

    body[role="application"] section button {
      left: 80%;
    }

    body[role="application"] section label.icon {
      background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAA8CAYAAABxVAqfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXg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ctb2iREPXOCLTYMkLQDj629YIkRizFa1fvnQjC/N9o8X8CDABI2xLhHAdAlAAAAABJRU5ErkJggg==);
    }

    body[role="application"] section label.icon:last-of-type {
      background-position: right -3rem;
    }
  </style>
</head>
<body>


<h2 class="bb-docs">Seekbars (using progress tag)</h2>
  <section>
    <div role="slider" aria-valuemin="0" aria-valuenow="80" aria-valuemax="100" aria-valuetext="slider description">
      <div>
        <progress value="80" max="100"></progress>
        <button>handler</button>
      </div>
    </div>
  </section>

  <h2 class="bb-docs">Value seeker</h2>
  <section>
    <div role="slider" aria-valuemin="0" aria-valuenow="80" aria-valuemax="100" aria-valuetext="slider description">
      <label>0</label>
      <label>100</label>
      <div>
        <progress value="80" max="100"></progress>
        <button>handler</button>
      </div>
    </div>
  </section>

  <h2 class="bb-docs">Icon seeker</h2>
  <section>
    <div role="slider" aria-valuemin="0" aria-valuenow="80" aria-valuemax="100" aria-valuetext="slider description">
      <label class="icon">0</label>
      <label class="icon">100</label>
      <div>
        <progress value="80" max="100"></progress>
        <button>handler</button>
      </div>
    </div>
  </section>

  <h2 class="bb-docs">Seekbars (using Input type range)</h2>
  <section>
    <input type="range">
  </section>

  <h2 class="bb-docs">Value seeker</h2>
  <section role="slider">
    <label>0</label>
    <label>100</label>
    <div>
      <input type="range">
    </div>
  </section>

  <h2 class="bb-docs">Value seeker</h2>
  <section role="slider">
    <label class="icon">0</label>
    <label class="icon">100</label>
    <div>
      <input type="range">
    </div>
  </section>
</body>
</html>

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, chrisdavidmills-github
 Last updated by: chrisdavidmills,