Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / third_party / polymer / components / paper-icon-button / paper-icon-button.html
blob512281b05caf455999626fc74decb11964d6ac3f
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
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
8 -->
10 <!--
11 @group Paper Elements
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.
26 Example:
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>
33 Styling
34 -------
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 {
47 color: blue;
50 The opacity of the ripple is not customizable via CSS.
52 Accessibility
53 -------------
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
63 @homepage github.io
64 -->
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">
74 <template>
76 <style>
77 :host {
78 display: inline-block;
79 position: relative;
80 padding: 8px;
81 outline: none;
82 -webkit-user-select: none;
83 -moz-user-select: none;
84 -ms-user-select: none;
85 user-select: none;
86 cursor: pointer;
87 z-index: 0;
90 :host([disabled]) {
91 color: #c9c9c9;
92 pointer-events: none;
93 cursor: auto;
96 #ripple {
97 pointer-events: none;
98 z-index: -1;
101 #icon {
102 display: block;
103 pointer-events: none;
105 </style>
107 <!-- to position to ripple behind the icon -->
108 <core-icon relative id="icon" src="{{src}}" icon="{{icon}}"></core-icon>
110 </template>
112 <script>
113 Polymer({
115 publish: {
118 * The URL of an image for the icon. If the src property is specified,
119 * the icon property should not be.
121 * @attribute src
122 * @type string
123 * @default ''
125 src: '',
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.
132 * @attribute icon
133 * @type string
134 * @default ''
136 icon: '',
138 recenteringTouch: true,
139 fill: false
143 iconChanged: function(oldIcon) {
144 var label = this.getAttribute('aria-label');
145 if (!label || label === oldIcon) {
146 this.setAttribute('aria-label', this.icon);
152 </script>
154 </polymer-element>