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
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS
5 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
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
13 Material Design: <a href="http://www.google.com/design/spec/components/buttons.html">Buttons</a>
15 `paper-icon-button` is a button with an image placed at the center. When the user touches
16 the button, a ripple effect emanates from the center of the button.
18 `paper-icon-button` includes a default icon set. Use `icon` to specify which icon
19 from the icon set to use.
21 <paper-icon-button icon="menu"></paper-icon-button>
23 See [`core-iconset`](#core-iconset) for more information about
24 how to use a custom icon set.
28 <link href="path/to/core-icons/core-icons.html" rel="import">
30 <paper-icon-button icon="favorite"></paper-icon-button>
31 <paper-icon-button src="star.png"></paper-icon-button>
36 Style the button with CSS as you would a normal DOM element. If you are using the icons
37 provided by `core-icons`, they will inherit the foreground color of the button.
39 /* make a red "favorite" button */
40 <paper-icon-button icon="favorite" style="color: red;"></paper-icon-button>
42 By default, the ripple is the same color as the foreground at 25% opacity. You may
43 customize the color using this selector:
45 /* make #my-button use a blue ripple instead of foreground color */
46 #my-button::shadow #ripple {
50 The opacity of the ripple is not customizable via CSS.
55 The button is accessible by default if you use the `icon` property. By default, the
56 `aria-label` attribute will be set to the `icon` property. If you use a custom icon,
57 you should ensure that the `aria-label` attribute is set.
59 <paper-icon-button src="star.png" aria-label="star"></paper-icon-button>
61 @element paper-icon-button
62 @extends paper-button-base
66 <link href=
"../polymer/polymer.html" rel=
"import">
67 <link href=
"../core-icon/core-icon.html" rel=
"import">
68 <link href=
"../core-icons/core-icons.html" rel=
"import">
69 <link href=
"../paper-button/paper-button-base.html" rel=
"import">
70 <link href=
"../paper-ripple/paper-ripple.html" rel=
"import">
72 <polymer-element name=
"paper-icon-button" extends=
"paper-button-base" attributes=
"src icon" role=
"button">
78 display: inline-block;
82 -webkit-user-select: none;
83 -moz-user-select: none;
84 -ms-user-select: none;
103 pointer-events: none;
107 <!-- to position to ripple behind the icon -->
108 <core-icon relative
id=
"icon" src=
"{{src}}" icon=
"{{icon}}"></core-icon>
118 * The URL of an image for the icon. If the src property is specified,
119 * the icon property should not be.
128 * Specifies the icon name or index in the set of icons available in
129 * the icon's icon set. If the icon property is specified,
130 * the src property should not be.
138 recenteringTouch
: true,
143 iconChanged: function(oldIcon
) {
144 var label
= this.getAttribute('aria-label');
145 if (!label
|| label
=== oldIcon
) {
146 this.setAttribute('aria-label', this.icon
);