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 `core-toolbar` is a horizontal bar containing items that can be used for
12 label, navigation, search and actions. The items place inside the
13 `core-toolbar` are projected into a `horizontal center layout` container inside of
14 `core-toolbar`'s Shadow DOM. You can use flex attributes to control the items'
20 <core-icon-button icon="menu" on-tap="{{menuAction}}"></core-icon-button>
22 <core-icon-button icon="more" on-tap="{{moreAction}}"></core-icon-button>
25 `core-toolbar` has a standard height, but can made be taller by setting `tall`
26 class on the `core-toolbar`. This will make the toolbar 3x the normal height.
28 <core-toolbar class="tall">
29 <core-icon-button icon="menu"></core-icon-button>
32 Apply `medium-tall` class to make the toolbar medium tall. This will make the
33 toolbar 2x the normal height.
35 <core-toolbar class="medium-tall">
36 <core-icon-button icon="menu"></core-icon-button>
39 When `tall`, items can pin to either the top (default), middle or bottom. Use
40 `middle` class for middle content and `bottom` class for bottom content.
42 <core-toolbar class="tall">
43 <core-icon-button icon="menu"></core-icon-button>
44 <div class="middle indent">Middle Title</div>
45 <div class="bottom indent">Bottom Title</div>
48 For `medium-tall` toolbar, the middle and bottom contents overlap and are
49 pinned to the bottom. But `middleJustify` and `bottomJustify` attributes are
50 still honored separately.
52 To make an element completely fit at the bottom of the toolbar, use `fit` along
55 <core-toolbar class="tall">
56 <div id="progressBar" class="bottom fit"></div>
59 `core-toolbar` adapts to mobile/narrow layout when there is a `core-narrow` class set
60 on itself or any of its ancestors.
62 @group Polymer Core Elements
67 <link rel=
"import" href=
"../polymer/polymer.html">
69 <polymer-element name=
"core-toolbar" attributes=
"justify middleJustify bottomJustify">
72 <link rel=
"stylesheet" href=
"core-toolbar.css">
74 <div id=
"bottomBar" class=
"toolbar-tools" center horizontal layout
>
75 <content select=
".bottom"></content>
78 <div id=
"middleBar" class=
"toolbar-tools" center horizontal layout
>
79 <content select=
".middle"></content>
82 <div id=
"topBar" class=
"toolbar-tools" center horizontal layout
>
91 Polymer('core-toolbar', {
94 * Controls how the items are aligned horizontally.
95 * Options are `start`, `center`, `end`, `between` and `around`.
104 * Controls how the items are aligned horizontally when they are placed
106 * Options are `start`, `center`, `end`, `between` and `around`.
108 * @attribute middleJustify
115 * Controls how the items are aligned horizontally when they are placed
117 * Options are `start`, `center`, `end`, `between` and `around`.
119 * @attribute bottomJustify
125 justifyChanged: function(old
) {
126 this.updateBarJustify(this.$.topBar
, this.justify
, old
);
129 middleJustifyChanged: function(old
) {
130 this.updateBarJustify(this.$.middleBar
, this.middleJustify
, old
);
133 bottomJustifyChanged: function(old
) {
134 this.updateBarJustify(this.$.bottomBar
, this.bottomJustify
, old
);
137 updateBarJustify: function(bar
, justify
, old
) {
139 bar
.removeAttribute(this.toLayoutAttrName(old
));
142 bar
.setAttribute(this.toLayoutAttrName(justify
), '');
146 toLayoutAttrName: function(value
) {
147 return value
=== 'between' ? 'justified' : value
+ '-justified';