1<!-- 2@license 3Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 4This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 5The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 7Code distributed by Google as part of the polymer project is also 8subject 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-menu-behavior/iron-menu-behavior.html"> 13<link rel="import" href="../paper-styles/default-theme.html"> 14<link rel="import" href="paper-menu-shared-styles.html"> 15 16<!-- 17Material design: [Menus](https://www.google.com/design/spec/components/menus.html) 18 19`<paper-menu>` implements an accessible menu control with Material Design styling. The focused item 20is highlighted, and the selected item has bolded text. 21 22 <paper-menu> 23 <paper-item>Item 1</paper-item> 24 <paper-item>Item 2</paper-item> 25 </paper-menu> 26 27An initial selection can be specified with the `selected` attribute. 28 29 <paper-menu selected="0"> 30 <paper-item>Item 1</paper-item> 31 <paper-item>Item 2</paper-item> 32 </paper-menu> 33 34Make a multi-select menu with the `multi` attribute. Items in a multi-select menu can be deselected, 35and multiple items can be selected. 36 37 <paper-menu multi> 38 <paper-item>Item 1</paper-item> 39 <paper-item>Item 2</paper-item> 40 </paper-menu> 41 42### Styling 43 44The following custom properties and mixins are available for styling: 45 46Custom property | Description | Default 47----------------|-------------|---------- 48`--paper-menu-background-color` | Menu background color | `--primary-background-color` 49`--paper-menu-color` | Menu foreground color | `--primary-text-color` 50`--paper-menu-disabled-color` | Foreground color for a disabled item | `--disabled-text-color` 51`--paper-menu` | Mixin applied to the menu | `{}` 52`--paper-menu-selected-item` | Mixin applied to the selected item | `{}` 53`--paper-menu-focused-item` | Mixin applied to the focused item | `{}` 54`--paper-menu-focused-item-after` | Mixin applied to the ::after pseudo-element for the focused item | `{}` 55 56### Accessibility 57 58`<paper-menu>` has `role="menu"` by default. A multi-select menu will also have 59`aria-multiselectable` set. It implements key bindings to navigate through the menu with the up and 60down arrow keys, esc to exit the menu, and enter to activate a menu item. Typing the first letter 61of a menu item will also focus it. 62 63@group Paper Elements 64@element paper-menu 65@hero hero.svg 66@demo demo/index.html 67--> 68 69<dom-module id="paper-menu"> 70 <template> 71 <style include="paper-menu-shared-styles"></style> 72 <style> 73 :host { 74 display: block; 75 padding: 8px 0; 76 77 background: var(--paper-menu-background-color, --primary-background-color); 78 color: var(--paper-menu-color, --primary-text-color); 79 80 @apply(--paper-menu); 81 } 82 </style> 83 84 <div class="selectable-content"> 85 <content></content> 86 </div> 87 </template> 88 89 <script> 90 (function() { 91 Polymer({ 92 is: 'paper-menu', 93 94 behaviors: [ 95 Polymer.IronMenuBehavior 96 ] 97 }); 98 })(); 99 </script> 100</dom-module> 101