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.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
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.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --><!-- | 9 --><html><head><link rel="import" href="../polymer/polymer.html"> |
10 @group Paper Elements | 10 <link rel="import" href="../iron-icon/iron-icon.html"> |
| 11 <link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html"> |
| 12 <link rel="import" href="../paper-styles/default-theme.html"> |
| 13 <link rel="import" href="../paper-styles/color.html"> |
| 14 <link rel="import" href="../paper-material/paper-material.html"> |
| 15 <link rel="import" href="../paper-ripple/paper-ripple.html"> |
| 16 <link rel="import" href="../paper-behaviors/paper-button-behavior.html"> |
11 | 17 |
| 18 <!-- |
12 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h
tml">Button</a> | 19 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h
tml">Button</a> |
13 | 20 |
14 `paper-fab` is a floating action button. It contains an image placed in the cent
er and | 21 `paper-fab` is a floating action button. It contains an image placed in the cent
er and |
15 comes in two sizes: regular size and a smaller size by applying the attribute `m
ini`. When | 22 comes in two sizes: regular size and a smaller size by applying the attribute `m
ini`. When |
16 the user touches the button, a ripple effect emanates from the center of the but
ton. | 23 the user touches the button, a ripple effect emanates from the center of the but
ton. |
17 | 24 |
18 You may import `iron-icons` to use with this element, or provide a URL to a cust
om icon. | 25 You may import `iron-icons` to use with this element, or provide a URL to a cust
om icon. |
19 See `iron-iconset` for more information about how to use a custom icon set. | 26 See `iron-iconset` for more information about how to use a custom icon set. |
20 | 27 |
21 Example: | 28 Example: |
22 | 29 |
23 <link href="path/to/iron-icons/iron-icons.html" rel="import"> | 30 <link href="path/to/iron-icons/iron-icons.html" rel="import"> |
24 | 31 |
25 <paper-fab icon="add"></paper-fab> | 32 <paper-fab icon="add"></paper-fab> |
26 <paper-fab mini icon="favorite"></paper-fab> | 33 <paper-fab mini icon="favorite"></paper-fab> |
27 <paper-fab src="star.png"></paper-fab> | 34 <paper-fab src="star.png"></paper-fab> |
28 | 35 |
29 Styling | |
30 ------- | |
31 | 36 |
32 Style the button with CSS as you would a normal DOM element. If you are using th
e icons | 37 ### Styling |
33 provided by `iron-icons`, the icon will inherit the foreground color of the butt
on. | |
34 | 38 |
35 /* make a blue "cloud" button */ | 39 The following custom properties and mixins are available for styling: |
36 <paper-fab icon="cloud" style="color: blue;"></paper-fab> | |
37 | 40 |
38 By default, the ripple is the same color as the foreground at 25% opacity. You m
ay | 41 Custom property | Description | Default |
39 customize the color using this selector: | 42 ----------------|-------------|---------- |
| 43 `--paper-fab-background` | The background color of the button | `--paper-indigo-
500` |
| 44 `--paper-fab-disabled-background` | The background color of the button when it's
disabled | `--paper-grey-300` |
| 45 `--paper-fab-disabled-text` | The text color of the button when it's disabled |
`--paper-grey-500` |
| 46 `--paper-fab` | Mixin applied to the button | `{}` |
| 47 `--paper-fab-mini` | Mixin applied to a mini button | `{}` |
| 48 `--paper-fab-disabled` | Mixin applied to a disabled button | `{}` |
40 | 49 |
41 /* make #my-button use a blue ripple instead of foreground color */ | 50 @group Paper Elements |
42 #my-button::shadow #ripple { | 51 @demo demo/index.html |
43 color: blue; | |
44 } | |
45 | 52 |
46 The opacity of the ripple is not customizable via CSS. | 53 --> |
47 | |
48 @element paper-fab | |
49 @status unstable | |
50 --><html><head><link rel="import" href="../polymer/polymer.html"> | |
51 <link rel="import" href="../iron-icon/iron-icon.html"> | |
52 <link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html"> | |
53 <link rel="import" href="../paper-styles/default-theme.html"> | |
54 <link rel="import" href="../paper-material/paper-material.html"> | |
55 <link rel="import" href="../paper-ripple/paper-ripple.html"> | |
56 <link rel="import" href="../paper-behaviors/paper-button-behavior.html"> | |
57 | |
58 <style is="x-style"> | |
59 * { | |
60 --paper-fab-disabled-text: #c9c9c9; | |
61 --paper-fab-disabled-background: var(--accent-color); | |
62 } | |
63 </style> | |
64 | 54 |
65 </head><body><dom-module id="paper-fab"> | 55 </head><body><dom-module id="paper-fab"> |
66 <style> | 56 <style> |
67 | 57 |
68 :host { | 58 :host { |
69 display: inline-block; | 59 display: inline-block; |
70 position: relative; | 60 position: relative; |
71 outline: none; | 61 outline: none; |
72 -moz-user-select: none; | 62 -moz-user-select: none; |
73 -ms-user-select: none; | 63 -ms-user-select: none; |
74 -webkit-user-select: none; | 64 -webkit-user-select: none; |
75 user-select: none; | 65 user-select: none; |
76 cursor: pointer; | 66 cursor: pointer; |
77 | 67 |
78 box-sizing: border-box; | 68 box-sizing: border-box; |
79 min-width: 0; | 69 min-width: 0; |
80 width: 56px; | 70 width: 56px; |
81 height: 56px; | 71 height: 56px; |
82 background: var(--accent-color); | 72 background: var(--paper-fab-background, --paper-indigo-500); |
83 color: var(--text-primary-color); | 73 color: var(--text-primary-color); |
84 border-radius: 50%; | 74 border-radius: 50%; |
85 padding: 16px; | 75 padding: 16px; |
86 | 76 |
87 z-index: 0; | 77 z-index: 0; |
88 | 78 |
89 mixin(--paper-fab); | 79 @apply(--paper-fab); |
90 } | 80 } |
91 | 81 |
92 :host([mini]) { | 82 :host([mini]) { |
93 width: 40px; | 83 width: 40px; |
94 height: 40px; | 84 height: 40px; |
95 padding: 8px; | 85 padding: 8px; |
96 | 86 |
97 mixin(--paper-fab-mini); | 87 @apply(--paper-fab-mini); |
98 } | 88 } |
99 | 89 |
100 :host([disabled]) { | 90 :host([disabled]) { |
101 color: var(--paper-fab-disabled-text); | 91 color: var(--paper-fab-disabled-text, --paper-grey-500); |
102 | 92 background: var(--paper-fab-disabled-background, --paper-grey-300); |
103 mixin(--paper-fab-disabled); | 93 @apply(--paper-fab-disabled); |
104 } | 94 } |
105 | 95 |
106 paper-material { | 96 paper-material { |
107 border-radius: inherit; | 97 border-radius: inherit; |
108 } | 98 } |
109 </style> | 99 </style> |
110 <template> | 100 <template> |
111 <paper-ripple></paper-ripple> | 101 <paper-ripple></paper-ripple> |
112 <paper-material class="content fit flex layout vertical center-center" eleva
tion="[[elevation]]" animated=""> | 102 <paper-material class="content fit flex layout vertical center-center" eleva
tion="[[elevation]]" animated=""> |
113 <iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon> | 103 <iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon> |
114 </paper-material> | 104 </paper-material> |
115 </template> | 105 </template> |
116 </dom-module> | 106 </dom-module> |
117 <script src="paper-fab-extracted.js"></script></body></html> | 107 <script src="paper-fab-extracted.js"></script></body></html> |
OLD | NEW |