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
11 * @module Polymer Core Elements
14 * core-menu-button is a core-icon-button with a drop down menu
15 * that allows the user to select an option. The drop down menu is styled with
16 * an arrow pointing to the button, and can be positioned to the top or the
17 * bottom of the button with the valign property. The valign property aligns
18 * the menu to the left or right edge of the button.
22 * <core-menu-button selected="0">
23 * <core-item icon="settings" label="Settings"></core-item>
24 * <core-item icon="dialog" label="Dialog"></core-item>
25 * <core-item icon="search" label="Search"></core-item>
28 * @class core-menu-button
31 <link href="../polymer/polymer.html" rel="import">
32 <link href="../core-icon-button/core-icon-button.html" rel="import">
33 <link href="../core-menu/core-menu.html" rel="import">
34 <link href="../core-overlay/core-overlay.html" rel="import">
36 <polymer-element name="core-menu-button" attributes="icon label src selected opened halign valign valueattr multi inlineMenu">
38 <link rel="stylesheet" href="core-menu-button.css">
39 <core-overlay target="{{$.overlay}}" opened="{{opened}}" layered?="{{!inlineMenu}}"></core-overlay>
40 <core-icon-button id="button" on-tap="{{toggle}}" src="{{src}}" icon="{{icon}}" active="{{opened}}"><span>{{label}}</span></core-icon-button>
41 <div id="overlay" halign="{{halign}}" valign="{{valign}}">
49 border: 1px solid #ccc;
51 /* overlay styling must be complete */
59 #overlay[halign=right] {
64 #overlay[valign=top] {
69 <core-menu id="menu" selected="{{selected}}" selectedItem="{{selectedItem}}" selectedClass="{{selectedClass}}" valueattr="{{valueattr}}" multi="{{multi}}" on-core-select="{{closeAction}}">
70 <content select="*"></content>
75 Polymer('core-menu-button', {
77 * The icon to display.
84 * The index of the selected menu item.
90 * Set to true to open the menu.
96 * Set to true to cause the menu popup to be displayed inline rather
97 * than in its own layer.
98 * @attribute inlineMenu
103 * Horizontally align the overlay with the button. Accepted values are
104 * ["left", "center", "right"].
110 * Display the overlay on top or below the button. Accepted values are
117 closeAction: function() {
121 * Toggle the opened state of the dropdown.
125 this.opened = !this.opened;
128 * The selected menu item.
129 * @property selection
133 return this.$.menu.selection;