1 <!-- 2 @license 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 4 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7 Code distributed by Google as part of the polymer project is also 8 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 9 --> 10 11 <link rel="import" href="../polymer/polymer.html"> 12 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> 13 <link rel="import" href="paper-item-behavior.html"> 14 <link rel="import" href="paper-item-shared-styles.html"> 15 16 <!-- 17 Material design: [Lists](https://www.google.com/design/spec/components/lists.html) 18 19 `<paper-item>` is an interactive list item. By default, it is a horizontal flexbox. 20 21 <paper-item>Item</paper-item> 22 23 Use this element with `<paper-item-body>` to make Material Design styled two-line and three-line 24 items. 25 26 <paper-item> 27 <paper-item-body two-line> 28 <div>Show your status</div> 29 <div secondary>Your status is visible to everyone</div> 30 </paper-item-body> 31 <iron-icon icon="warning"></iron-icon> 32 </paper-item> 33 34 To use `paper-item` as a link, wrap it in an anchor tag. Since `paper-item` will 35 already receive focus, you may want to prevent the anchor tag from receiving 36 focus as well by setting its tabindex to -1. 37 38 <a href="https://www.polymer-project.org/" tabindex="-1"> 39 <paper-item raised>Polymer Project</paper-item> 40 </a> 41 42 If you are concerned about performance and want to use `paper-item` in a `paper-listbox` 43 with many items, you can just use a native `button` with the `paper-item` class 44 applied (provided you have correctly included the shared styles): 45 46 <style is="custom-style" include="paper-item-shared-styles"></style> 47 48 <paper-listbox> 49 <button class="paper-item" role="option">Inbox</button> 50 <button class="paper-item" role="option">Starred</button> 51 <button class="paper-item" role="option">Sent mail</button> 52 </paper-listbox> 53 54 ### Styling 55 56 The following custom properties and mixins are available for styling: 57 58 Custom property | Description | Default 59 ------------------------------|----------------------------------------------|---------- 60 `--paper-item-min-height` | Minimum height of the item | `48px` 61 `--paper-item` | Mixin applied to the item | `{}` 62 `--paper-item-selected-weight`| The font weight of a selected item | `bold` 63 `--paper-item-selected` | Mixin applied to selected paper-items | `{}` 64 `--paper-item-disabled-color` | The color for disabled paper-items | `--disabled-text-color` 65 `--paper-item-disabled` | Mixin applied to disabled paper-items | `{}` 66 `--paper-item-focused` | Mixin applied to focused paper-items | `{}` 67 `--paper-item-focused-before` | Mixin applied to :before focused paper-items | `{}` 68 69 ### Accessibility 70 71 This element has `role="listitem"` by default. Depending on usage, it may be more appropriate to set 72 `role="menuitem"`, `role="menuitemcheckbox"` or `role="menuitemradio"`. 73 74 <paper-item role="menuitemcheckbox"> 75 <paper-item-body> 76 Show your status 77 </paper-item-body> 78 <paper-checkbox></paper-checkbox> 79 </paper-item> 80 81 @group Paper Elements 82 @element paper-item 83 @demo demo/index.html 84 --> 85 86 <dom-module id="paper-item"> 87 <template> 88 <style include="paper-item-shared-styles"></style> 89 <style> 90 :host { 91 @apply(--layout-horizontal); 92 @apply(--layout-center); 93 @apply(--paper-font-subhead); 94 95 @apply(--paper-item); 96 } 97 </style> 98 99 <content></content> 100 </template> 101 102 <script> 103 Polymer({ 104 is: 'paper-item', 105 106 behaviors: [ 107 Polymer.PaperItemBehavior 108 ] 109 }); 110 </script> 111 </dom-module> 112