Remove LOAD_SUB_FRAME load flag.
[chromium-blink-merge.git] / third_party / polymer / components / core-dropdown-menu / core-dropdown-menu.html
blobc06f4c0fcbd953fd816fd33d3c2f839ade4b7f7b
1 <!--
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
8 -->
10 <!--
12 `core-dropdown-menu` works together with `core-dropdown` and `core-selector` to
13 implement a drop-down menu. The currently selected item is displayed in the
14 control. If no item is selected, the `label` is displayed instead.
16 The child element with the class `dropdown` will be used as the drop-down
17 menu. It should be a `core-dropdown` or other overlay element. You should
18 also provide a `core-selector` or other selector element, such as `core-menu`,
19 in the drop-down.
21 Example:
23 <core-dropdown-menu label="Choose a pastry">
24 <core-dropdown class="dropdown">
25 <core-selector>
26 <core-item label="Croissant"></core-item>
27 <core-item label="Donut"></core-item>
28 <core-item label="Financier"></core-item>
29 <core-item label="Madeleine"></core-item>
30 </core-selector>
31 </core-dropdown>
32 </core-dropdown-menu>
34 @group Polymer Core Elements
35 @element core-dropdown-menu
36 @extends core-dropdown-base
37 @status unstable
38 @homepage github.io
39 -->
41 <link href="../polymer/polymer.html" rel="import">
42 <link href="../core-a11y-keys/core-a11y-keys.html" rel="import">
43 <link href="../core-dropdown/core-dropdown-base.html" rel="import">
44 <link href="../core-focusable/core-focusable.html" rel="import">
45 <link href="../core-icon/core-icon.html" rel="import">
46 <link href="../core-icons/core-icons.html" rel="import">
48 <polymer-element name="core-dropdown-menu" extends="core-dropdown-base" relative layout inline horizontal center tabindex="0">
49 <template>
51 <style>
52 :host {
53 background-color: #fff;
56 :host([disabled]) {
57 color: #a8a8a8;
60 #label {
61 overflow: hidden;
62 white-space: nowrap;
63 text-overflow: ellipsis;
65 </style>
67 <core-a11y-keys target="{{}}" keys="enter space" on-keys-pressed="{{toggleOverlay}}"></core-a11y-keys>
69 <div flex auto id="label">{{selectedItemLabel || label}}</div>
70 <core-icon id="arrow" icon="{{opened ? openedIcon : closedIcon}}"></core-icon>
72 <content></content>
74 </template>
75 <script>
77 (function() {
79 var p = {
81 publish: {
83 /**
84 * A label for the control. The label is displayed if no item is selected.
86 * @attribute label
87 * @type string
88 * @default 'Select an item'
90 label: 'Select an item',
92 /**
93 * The icon to display when the drop-down is opened.
95 * @attribute openedIcon
96 * @type string
97 * @default 'arrow-drop-up'
99 openedIcon: 'arrow-drop-up',
102 * The icon to display when the drop-down is closed.
104 * @attribute closedIcon
105 * @type string
106 * @default 'arrow-drop-down'
108 closedIcon: 'arrow-drop-down'
112 selectedItemLabel: '',
114 overlayListeners: {
115 'core-overlay-open': 'openAction',
116 'core-activate': 'activateAction',
117 'core-select': 'selectAction'
120 activateAction: function(e) {
121 this.opened = false;
124 selectAction: function(e) {
125 var detail = e.detail;
126 if (detail.isSelected) {
127 this.selectedItemLabel = detail.item.label || detail.item.textContent;
128 } else {
129 this.selectedItemLabel = '';
135 Polymer.mixin2(p, Polymer.CoreFocusable);
136 Polymer(p);
138 })();
140 </script>
141 </polymer-element>