OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 @license |
| 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.g
ithub.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/CONTRI
BUTORS |
| 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/PATEN
TS |
| 9 --> |
| 10 |
| 11 <!-- |
| 12 @group Paper Elements |
| 13 |
| 14 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h
tml">Buttons</a> |
| 15 |
| 16 `paper-icon-button` is a button with an image placed at the center. When the use
r touches |
| 17 the button, a ripple effect emanates from the center of the button. |
| 18 |
| 19 `paper-icon-button` includes a default icon set. Use `icon` to specify which ic
on |
| 20 from the icon set to use. |
| 21 |
| 22 <paper-icon-button icon="menu"></paper-icon-button> |
| 23 |
| 24 See [`iron-iconset`](#iron-iconset) for more information about |
| 25 how to use a custom icon set. |
| 26 |
| 27 Example: |
| 28 |
| 29 <link href="path/to/iron-icons/iron-icons.html" rel="import"> |
| 30 |
| 31 <paper-icon-button icon="favorite"></paper-icon-button> |
| 32 <paper-icon-button src="star.png"></paper-icon-button> |
| 33 |
| 34 Styling |
| 35 ------- |
| 36 |
| 37 Style the button with CSS as you would a normal DOM element. If you are using th
e icons |
| 38 provided by `iron-icons`, they will inherit the foreground color of the button. |
| 39 |
| 40 /* make a red "favorite" button */ |
| 41 <paper-icon-button icon="favorite" style="color: red;"></paper-icon-button> |
| 42 |
| 43 By default, the ripple is the same color as the foreground at 25% opacity. You m
ay |
| 44 customize the color using this selector: |
| 45 |
| 46 /* make #my-button use a blue ripple instead of foreground color */ |
| 47 #my-button::shadow #ripple { |
| 48 color: blue; |
| 49 } |
| 50 |
| 51 The opacity of the ripple is not customizable via CSS. |
| 52 |
| 53 @element paper-icon-button |
| 54 @homepage github.io |
| 55 --> |
| 56 |
| 57 <link rel="import" href="../polymer/polymer.html"> |
| 58 <link rel="import" href="../iron-icon/iron-icon.html"> |
| 59 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> |
| 60 <link rel="import" href="../paper-styles/default-theme.html"> |
| 61 <link rel="import" href="../paper-behaviors/paper-button-behavior.html"> |
| 62 <link rel="import" href="../paper-ripple/paper-ripple.html"> |
| 63 |
| 64 <style is="x-style"> |
| 65 * { |
| 66 --paper-icon-button-disabled-text: var(--disabled-text-color); |
| 67 } |
| 68 </style> |
| 69 |
| 70 <dom-module id="paper-icon-button"> |
| 71 <style> |
| 72 :host { |
| 73 display: inline-block; |
| 74 position: relative; |
| 75 padding: 8px; |
| 76 outline: none; |
| 77 -webkit-user-select: none; |
| 78 -moz-user-select: none; |
| 79 -ms-user-select: none; |
| 80 user-select: none; |
| 81 cursor: pointer; |
| 82 z-index: 0; |
| 83 |
| 84 mixin(--paper-icon-button); |
| 85 } |
| 86 |
| 87 :host([disabled]) { |
| 88 color: var(--paper-icon-button-disabled-text); |
| 89 pointer-events: none; |
| 90 cursor: auto; |
| 91 |
| 92 mixin(--paper-icon-button-disabled); |
| 93 } |
| 94 </style> |
| 95 <template> |
| 96 <paper-ripple class="circle" recenters></paper-ripple> |
| 97 <iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon> |
| 98 </template> |
| 99 </dom-module> |
| 100 <script> |
| 101 Polymer({ |
| 102 is: 'paper-icon-button', |
| 103 |
| 104 behaviors: [ |
| 105 Polymer.PaperButtonBehavior |
| 106 ], |
| 107 |
| 108 enableCustomStyleProperties: true, |
| 109 |
| 110 properties: { |
| 111 /** |
| 112 * The URL of an image for the icon. If the src property is specified, |
| 113 * the icon property should not be. |
| 114 */ |
| 115 src: { |
| 116 type: String |
| 117 }, |
| 118 |
| 119 /** |
| 120 * Specifies the icon name or index in the set of icons available in |
| 121 * the icon's icon set. If the icon property is specified, |
| 122 * the src property should not be. |
| 123 */ |
| 124 icon: { |
| 125 type: String |
| 126 } |
| 127 } |
| 128 }); |
| 129 </script> |
| 130 |
OLD | NEW |