| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 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 | 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 | 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 | 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 | 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 | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS |
| 9 --><html><head><link rel="import" href="../polymer/polymer.html"> | 9 --><html><head><link rel="import" href="../polymer/polymer.html"> |
| 10 <link rel="import" href="../iron-icon/iron-icon.html"> | 10 <link rel="import" href="../iron-icon/iron-icon.html"> |
| 11 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> | 11 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> |
| 12 <link rel="import" href="../paper-styles/default-theme.html"> | 12 <link rel="import" href="../paper-styles/default-theme.html"> |
| 13 <link rel="import" href="../paper-behaviors/paper-button-behavior.html"> | 13 <link rel="import" href="../paper-behaviors/paper-button-behavior.html"> |
| 14 <link rel="import" href="../paper-behaviors/paper-inky-focus-behavior.html"> | 14 <link rel="import" href="../paper-behaviors/paper-inky-focus-behavior.html"> |
| 15 <link rel="import" href="../paper-ripple/paper-ripple.html"> | 15 <link rel="import" href="../paper-ripple/paper-ripple.html"> |
| 16 | 16 |
| 17 <!-- | 17 <!-- |
| 18 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h
tml">Buttons</a> | 18 Material design: [Icon toggles](https://www.google.com/design/spec/components/bu
ttons.html#buttons-toggle-buttons) |
| 19 | 19 |
| 20 `paper-icon-button` is a button with an image placed at the center. When the use
r touches | 20 `paper-icon-button` is a button with an image placed at the center. When the use
r touches |
| 21 the button, a ripple effect emanates from the center of the button. | 21 the button, a ripple effect emanates from the center of the button. |
| 22 | 22 |
| 23 `paper-icon-button` includes a default icon set. Use `icon` to specify which ic
on | 23 `paper-icon-button` includes a default icon set. Use `icon` to specify which ic
on |
| 24 from the icon set to use. | 24 from the icon set to use. |
| 25 | 25 |
| 26 <paper-icon-button icon="menu"></paper-icon-button> | 26 <paper-icon-button icon="menu"></paper-icon-button> |
| 27 | 27 |
| 28 See [`iron-iconset`](#iron-iconset) for more information about | 28 See [`iron-iconset`](#iron-iconset) for more information about |
| 29 how to use a custom icon set. | 29 how to use a custom icon set. |
| 30 | 30 |
| 31 Example: | 31 Example: |
| 32 | 32 |
| 33 <link href="path/to/iron-icons/iron-icons.html" rel="import"> | 33 <link href="path/to/iron-icons/iron-icons.html" rel="import"> |
| 34 | 34 |
| 35 <paper-icon-button icon="favorite"></paper-icon-button> | 35 <paper-icon-button icon="favorite"></paper-icon-button> |
| 36 <paper-icon-button src="star.png"></paper-icon-button> | 36 <paper-icon-button src="star.png"></paper-icon-button> |
| 37 | 37 |
| 38 ###Styling | 38 ### Styling |
| 39 | 39 |
| 40 Style the button with CSS as you would a normal DOM element. If you are using th
e icons | 40 Style the button with CSS as you would a normal DOM element. If you are using th
e icons |
| 41 provided by `iron-icons`, they will inherit the foreground color of the button. | 41 provided by `iron-icons`, they will inherit the foreground color of the button. |
| 42 | 42 |
| 43 /* make a red "favorite" button */ | 43 /* make a red "favorite" button */ |
| 44 <paper-icon-button icon="favorite" style="color: red;"></paper-icon-button> | 44 <paper-icon-button icon="favorite" style="color: red;"></paper-icon-button> |
| 45 | 45 |
| 46 By default, the ripple is the same color as the foreground at 25% opacity. You m
ay | 46 By default, the ripple is the same color as the foreground at 25% opacity. You m
ay |
| 47 customize the color using this selector: | 47 customize the color using the `--paper-icon-button-ink-color` custom property. |
| 48 | |
| 49 /* make #my-button use a blue ripple instead of foreground color */ | |
| 50 #my-button::shadow #ripple { | |
| 51 color: blue; | |
| 52 } | |
| 53 | |
| 54 The opacity of the ripple is not customizable via CSS. | |
| 55 | 48 |
| 56 The following custom properties and mixins are available for styling: | 49 The following custom properties and mixins are available for styling: |
| 57 | 50 |
| 58 Custom property | Description | Default | 51 Custom property | Description | Default |
| 59 ----------------|-------------|---------- | 52 ----------------|-------------|---------- |
| 60 `--paper-icon-button-disabled-text` | The color of the disabled button | `--prim
ary-text-color` | 53 `--paper-icon-button-disabled-text` | The color of the disabled button | `--disa
bled-text-color` |
| 61 `--paper-icon-button-ink-color` | Selected/focus ripple color | `--default-prima
ry-color` | 54 `--paper-icon-button-ink-color` | Selected/focus ripple color | `--primary-text-
color` |
| 62 `--paper-icon-button` | Mixin for a button | `{}` | 55 `--paper-icon-button` | Mixin for a button | `{}` |
| 63 `--paper-icon-button-disabled` | Mixin for a disabled button | `{}` | 56 `--paper-icon-button-disabled` | Mixin for a disabled button | `{}` |
| 64 | 57 |
| 65 @group Paper Elements | 58 @group Paper Elements |
| 66 @element paper-icon-button | 59 @element paper-icon-button |
| 67 @demo demo/index.html | 60 @demo demo/index.html |
| 68 --> | 61 --> |
| 69 | 62 |
| 70 </head><body><dom-module id="paper-icon-button"> | 63 </head><body><dom-module id="paper-icon-button"> |
| 71 <style> | 64 <template strip-whitespace=""> |
| 65 <style> |
| 66 :host { |
| 67 display: inline-block; |
| 68 position: relative; |
| 69 padding: 8px; |
| 70 outline: none; |
| 71 -webkit-tap-highlight-color: rgba(0,0,0,0); |
| 72 -webkit-user-select: none; |
| 73 -moz-user-select: none; |
| 74 -ms-user-select: none; |
| 75 user-select: none; |
| 76 cursor: pointer; |
| 77 z-index: 0; |
| 72 | 78 |
| 73 :host { | 79 width: 24px; |
| 74 display: inline-block; | 80 @apply(--paper-icon-button); |
| 75 position: relative; | 81 } |
| 76 padding: 8px; | |
| 77 outline: none; | |
| 78 -webkit-tap-highlight-color: rgba(0,0,0,0); | |
| 79 -webkit-user-select: none; | |
| 80 -moz-user-select: none; | |
| 81 -ms-user-select: none; | |
| 82 user-select: none; | |
| 83 cursor: pointer; | |
| 84 z-index: 0; | |
| 85 | 82 |
| 86 @apply(--paper-icon-button); | 83 :host #ink { |
| 87 } | 84 color: var(--paper-icon-button-ink-color, --primary-text-color); |
| 85 opacity: 0.6; |
| 86 } |
| 88 | 87 |
| 89 :host #ink { | 88 :host([disabled]) { |
| 90 color: var(--paper-icon-button-ink-color, --primary-text-color); | 89 color: var(--paper-icon-button-disabled-text, --disabled-text-color); |
| 91 opacity: 0.6; | 90 pointer-events: none; |
| 92 } | 91 cursor: auto; |
| 92 @apply(--paper-icon-button-disabled); |
| 93 } |
| 93 | 94 |
| 94 :host([disabled]) { | 95 iron-icon { |
| 95 color: var(--paper-icon-button-disabled-text, --disabled-text-color); | 96 --iron-icon-width: 100%; |
| 96 pointer-events: none; | 97 --iron-icon-height: 100%; |
| 97 cursor: auto; | 98 } |
| 98 @apply(--paper-icon-button-disabled); | 99 </style> |
| 99 } | |
| 100 </style> | |
| 101 <template> | |
| 102 <paper-ripple id="ink" class="circle" center=""></paper-ripple> | |
| 103 <iron-icon id="icon" src="[[src]]" icon="[[icon]]" alt$="[[alt]]"></iron-ico
n> | 100 <iron-icon id="icon" src="[[src]]" icon="[[icon]]" alt$="[[alt]]"></iron-ico
n> |
| 104 </template> | 101 </template> |
| 105 </dom-module> | 102 |
| 103 </dom-module> |
| 106 <script src="paper-icon-button-extracted.js"></script></body></html> | 104 <script src="paper-icon-button-extracted.js"></script></body></html> |
| OLD | NEW |