Polymer - Paper Slider



Paper-slider enables the user to select a value from the given range, by moving the slider point and represents the alteration of volume or color saturation in a particular application.

You can use this element in your application, by running the following command to install it in your project directory.

bower install --save PolymerElements/paper-slider

Example

The following example specifies the use of paper-slider element in Polymer.js. Create an index.html file and add the following code in it.

<!doctype html>
<html>
   <head>
      <link rel = 'import' href = 'my-app.html'>
   </head>
   
   <body>    
      <my-app></my-app>
   </body>
</html>

Now, open the my-app.html file and include the following code in it.

<link rel = 'import' href = 'bower_components/polymer/polymer.html'>
<link rel = "import" href = "bower_components/paper-slider/paper-slider.html">

<dom-module id = 'my-app'>
   <template>
      <style>
         paper-slider.green {
            --paper-slider-knob-color: var(--paper-green-500);
            --paper-slider-active-color: var(--paper-green-500);
         }
      </style>
      
      <h3>Paper-Slider Example</h3>
      <div>Volume</div>
      <paper-slider class = "green"  max = "50" editable></paper-slider>
      <div>Brightness</div>
      <paper-slider class = "green"  max = "50" editable></paper-slider>
      <div>Color (Disabled)</div>
      <paper-slider class = "green" Disabled value = "11" max = "50" editable></paper-slider>
   </template>
   
   <script>
      Polymer ({
         is: 'my-app', ready: function() {
            this.async(function() {         
            });
         }
      });
   </script>
</dom-module>

Output

To run the application, navigate to the created project directory and run the following command.

polymer serve

Now open the browse http://127.0.0.1:8081/. Following will be the output.

Polymer paper-ripple
polymer_elements.htm
Advertisements