3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS
6 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
11 <link rel=
"import" href=
"../polymer/polymer.html">
12 <link rel=
"import" href=
"../iron-icon/iron-icon.html">
13 <link rel=
"import" href=
"../iron-flex-layout/iron-flex-layout.html">
14 <link rel=
"import" href=
"../paper-styles/default-theme.html">
15 <link rel=
"import" href=
"../paper-behaviors/paper-button-behavior.html">
16 <link rel=
"import" href=
"../paper-behaviors/paper-inky-focus-behavior.html">
17 <link rel=
"import" href=
"../paper-ripple/paper-ripple.html">
20 Material Design: <a href="http://www.google.com/design/spec/components/buttons.html">Buttons</a>
22 `paper-icon-button` is a button with an image placed at the center. When the user touches
23 the button, a ripple effect emanates from the center of the button.
25 `paper-icon-button` includes a default icon set. Use `icon` to specify which icon
26 from the icon set to use.
28 <paper-icon-button icon="menu"></paper-icon-button>
30 See [`iron-iconset`](#iron-iconset) for more information about
31 how to use a custom icon set.
35 <link href="path/to/iron-icons/iron-icons.html" rel="import">
37 <paper-icon-button icon="favorite"></paper-icon-button>
38 <paper-icon-button src="star.png"></paper-icon-button>
42 Style the button with CSS as you would a normal DOM element. If you are using the icons
43 provided by `iron-icons`, they will inherit the foreground color of the button.
45 /* make a red "favorite" button */
46 <paper-icon-button icon="favorite" style="color: red;"></paper-icon-button>
48 By default, the ripple is the same color as the foreground at 25% opacity. You may
49 customize the color using this selector:
51 /* make #my-button use a blue ripple instead of foreground color */
52 #my-button::shadow #ripple {
56 The opacity of the ripple is not customizable via CSS.
58 The following custom properties and mixins are available for styling:
60 Custom property | Description | Default
61 ----------------|-------------|----------
62 `--paper-icon-button-disabled-text` | The color of the disabled button | `--primary-text-color`
63 `--paper-icon-button-ink-color` | Selected/focus ripple color | `--default-primary-color`
64 `--paper-icon-button` | Mixin for a button | `{}`
65 `--paper-icon-button-disabled` | Mixin for a disabled button | `{}`
68 @element paper-icon-button
72 <dom-module id=
"paper-icon-button">
76 display: inline-block;
80 -webkit-tap-highlight-color: rgba(
0,
0,
0,
0);
81 -webkit-user-select: none;
82 -moz-user-select: none;
83 -ms-user-select: none;
88 @apply(--paper-icon-button);
92 color: var(--paper-icon-button-ink-color, --primary-text-color);
97 color: var(--paper-icon-button-disabled-text, --disabled-text-color);
100 @apply(--paper-icon-button-disabled);
104 <paper-ripple id=
"ink" class=
"circle" center
></paper-ripple>
105 <iron-icon id=
"icon" src=
"[[src]]" icon=
"[[icon]]" alt$=
"[[alt]]"></iron-icon>
110 is
: 'paper-icon-button',
118 Polymer
.PaperInkyFocusBehavior
123 * The URL of an image for the icon. If the src property is specified,
124 * the icon property should not be.
131 * Specifies the icon name or index in the set of icons available in
132 * the icon's icon set. If the icon property is specified,
133 * the src property should not be.
140 * Specifies the alternate text for the button, for accessibility.
144 observer
: "_altChanged"
148 _altChanged: function(newValue
, oldValue
) {
149 var label
= this.getAttribute('aria-label');
151 // Don't stomp over a user-set aria-label.
152 if (!label
|| oldValue
== label
) {
153 this.setAttribute('aria-label', newValue
);