2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
10 A `paper-menu-button` is a `paper-icon-button` that opens a drop down menu when tapped.
14 <paper-menu-button icon="menu">
15 <div>Menu Item 1</div>
16 <div>Menu Item 2</div>
17 <div>Menu Item 3</div>
21 @element paper-menu-button
22 @extends paper-focusable
24 <link href="../polymer/polymer.html" rel="import">
25 <link href="../core-icon/core-icon.html" rel="import">
26 <link href="../core-menu/core-menu.html" rel="import">
27 <link href="../paper-focusable/paper-focusable.html" rel="import">
28 <link href="../paper-shadow/paper-shadow.html" rel="import">
29 <link href="paper-menu-button-overlay.html" rel="import">
30 <link href="paper-menu-button-transition.html" rel="import">
32 <polymer-element name="paper-menu-button-overlay-container" noscript>
38 <polymer-element name="paper-menu-button" extends="paper-focusable" attributes="src icon opened halign valign slow" on-tap="{{tapAction}}">
40 <link rel="stylesheet" href="paper-menu-button.css">
41 <paper-menu-button-overlay target="{{$.overlay}}" relatedTarget="{{}}" halign="{{halign}}" valign="{{valign}}" opened="{{opened}}" transition="paper-menu-button-transition-top-{{halign}}{{slow ? '-slow' : ''}}"></paper-menu-button-overlay>
42 <paper-menu-button-overlay-container id="overlay">
43 <paper-shadow target="{{$.overlayBg}}" z="0" hasPosition></paper-shadow>
44 <div class="paper-menu-button-overlay-ink"></div>
45 <div id="overlayBg" class="paper-menu-button-overlay-bg"></div>
49 </paper-menu-button-overlay-container>
50 <core-icon src="{{src}}" icon="{{icon}}"></core-icon>
53 Polymer('paper-menu-button', {
58 * If true, this menu is currently visible.
64 opened: { value: false, reflect: true },
67 * The horizontal alignment of the pulldown menu relative to the button.
70 * @type 'left' | 'right'
73 halign: { value: 'left', reflect: true },
76 * The vertical alignment of the pulldown menu relative to the button.
79 * @type 'bottom' | 'top'
82 valign: {value: 'top', reflect: true}
86 * The URL of an image for the icon. Should not use `icon` property
87 * if you are using this property.
96 * Specifies the icon name or index in the set of icons available in
97 * the icon set. Should not use `src` property if you are using this
108 tapAction: function() {
118 * Toggle the opened state of the menu.
123 this.opened = !this.opened;