Polymer - Paper Listbox



Paper-listbox is an easy-going listbox control combined with styling. The selected item has bold text. This element has multiple selection options and key bindings to navigate through the listbox. To get paper-listbox in your directory in working condition, you should run the following command in the command prompt.

bower install --save PolymerElements/paper-listbox

Example

Your index.html file should look like the following.

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

Your my-app.html file should look like the following.

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

<dom-module id = 'my-app'>
   <template>
      <style>
         paper-listbox {
            width: 200px;
            border: 1px dotted #ccc;
         }
         paper-item {
            cursor: pointer;
         }
      </style>
      
      <h3>Paper-Listbox Example </h3>
      <paper-listbox multi> 
         <paper-item>AngularJS Tutorial</paper-item>
         <paper-item disabled>C++ Tutorial</paper-item>
         <paper-item>C Tutorial</paper-item>
         <paper-item>Android Tutorial</paper-item>
      </paper-listbox>
   </template>
   
   <script>
      Polymer ({
         is: 'my-app', ready: function() {
            this.async(function() {         
            });
         }
      });
   </script>
</dom-module>

Output

Refresh the Polymer server and following will be the output.

Paper Listbox
polymer_elements.htm
Advertisements