Home | History | Annotate | Download | only in demo
      1 <!doctype html>
      2 <!--
      3 @license
      4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
      5 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
      6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
      7 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
      8 Code distributed by Google as part of the polymer project is also
      9 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
     10 -->
     11 
     12 <html>
     13   <head>
     14 
     15     <title>iron-selector</title>
     16 
     17     <meta charset="utf-8">
     18     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     19 
     20     <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
     21 
     22     <link rel="import" href="../../paper-styles/demo-pages.html">
     23     <link rel="import" href="../iron-selector.html">
     24 
     25     <style is="custom-style">
     26 
     27       iron-selector > * {
     28         padding: 8px;
     29       }
     30 
     31       .horizontal-section {
     32         padding: 0;
     33       }
     34 
     35       .iron-selected {
     36         background-color: var(--google-blue-500);
     37         color: white;
     38       }
     39 
     40     </style>
     41 
     42   </head>
     43   <body unresolved>
     44 
     45     <div class="horizontal center-justified layout">
     46       <div>
     47         <h3>Basic</h3>
     48         <div class="horizontal-section">
     49           <iron-selector selected="0">
     50             <div>Item 0</div>
     51             <div>Item 1</div>
     52             <div>Item 2</div>
     53             <div>Item 3</div>
     54             <div>Item 4</div>
     55           </iron-selector>
     56         </div>
     57       </div>
     58 
     59       <div>
     60         <h3>Multi-select</h3>
     61         <div class="horizontal-section">
     62           <iron-selector multi selected-values='[0,2]'>
     63             <div>Item 0</div>
     64             <div>Item 1</div>
     65             <div>Item 2</div>
     66             <div>Item 3</div>
     67             <div>Item 4</div>
     68           </iron-selector>
     69         </div>
     70       </div>
     71 
     72       <div>
     73         <h3>Example with attr-for-selected</h3>
     74         <div class="horizontal-section">
     75           <iron-selector selected="foo" attr-for-selected="name">
     76             <div name="foo">Foo</div>
     77             <div name="bar">Bar</div>
     78             <div name="baz">Baz</div>
     79             <div name="qux">Qux</div>
     80             <div name="quux">Quux</div>
     81           </iron-selector>
     82         </div>
     83       </div>
     84 
     85       <div>
     86         <h3>Example with fallback-selection</h3>
     87         <div class="horizontal-section">
     88           <iron-selector selected="non-existing" attr-for-selected="name" fallback-selection="default">
     89             <div name="foo">Foo</div>
     90             <div name="bar">Bar</div>
     91             <div name="baz">Baz</div>
     92             <div name="qux">Qux</div>
     93             <div name="quux">Quux</div>
     94             <div name="default">Default</div>
     95           </iron-selector>
     96         </div>
     97       </div>
     98     </div>
     99 
    100   </body>
    101 </html>
    102