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