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