OLD | NEW |
| (Empty) |
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.g
ithub.io/LICENSE.txt | |
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | |
5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | |
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/PATEN
TS.txt | |
8 --><!-- | |
9 @group Paper Elements | |
10 | |
11 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h
tml">Button</a> | |
12 | |
13 `paper-fab` is a floating action button. It contains an image placed in the cent
er and | |
14 comes in two sizes: regular size and a smaller size by applying the attribute `m
ini`. When | |
15 the user touches the button, a ripple effect emanates from the center of the but
ton. | |
16 | |
17 You may import `core-icons` to use with this element, or provide an URL to a cus
tom icon. | |
18 See `core-iconset` for more information about how to use a custom icon set. | |
19 | |
20 Example: | |
21 | |
22 <link href="path/to/core-icons/core-icons.html" rel="import"> | |
23 | |
24 <paper-fab icon="add"></paper-fab> | |
25 <paper-fab mini icon="favorite"></paper-fab> | |
26 <paper-fab src="star.png"></paper-fab> | |
27 | |
28 Styling | |
29 ------- | |
30 | |
31 Style the button with CSS as you would a normal DOM element. If you are using th
e icons | |
32 provided by `core-icons`, the icon will inherit the foreground color of the butt
on. | |
33 | |
34 /* make a blue "cloud" button */ | |
35 <paper-fab icon="cloud" style="color: blue;"></paper-fab> | |
36 | |
37 By default, the ripple is the same color as the foreground at 25% opacity. You m
ay | |
38 customize the color using this selector: | |
39 | |
40 /* make #my-button use a blue ripple instead of foreground color */ | |
41 #my-button::shadow #ripple { | |
42 color: blue; | |
43 } | |
44 | |
45 The opacity of the ripple is not customizable via CSS. | |
46 | |
47 Accessibility | |
48 ------------- | |
49 | |
50 The button is accessible by default if you use the `icon` property. By default,
the | |
51 `aria-label` attribute will be set to the `icon` property. If you use a custom i
con, | |
52 you should ensure that the `aria-label` attribute is set. | |
53 | |
54 <paper-fab src="star.png" aria-label="star"></paper-fab> | |
55 | |
56 @element paper-fab | |
57 @extends paper-button-base | |
58 @status unstable | |
59 --><html><head><link href="../polymer/polymer.html" rel="import"> | |
60 <link href="../core-icon/core-icon.html" rel="import"> | |
61 <link href="../paper-button/paper-button-base.html" rel="import"> | |
62 <link href="../paper-ripple/paper-ripple.html" rel="import"> | |
63 <link href="../paper-shadow/paper-shadow.html" rel="import"> | |
64 | |
65 </head><body><polymer-element name="paper-fab" extends="paper-button-base" attri
butes="src icon mini" role="button" assetpath=""> | |
66 | |
67 <template> | |
68 | |
69 <style> | |
70 :host { | |
71 display: inline-block; | |
72 position: relative; | |
73 outline: none; | |
74 -webkit-user-select: none; | |
75 user-select: none; | |
76 cursor: pointer; | |
77 z-index: 0; | |
78 | |
79 box-sizing: border-box; | |
80 width: 56px; | |
81 height: 56px; | |
82 background: #d23f31; | |
83 color: #fff; | |
84 border-radius: 50%; | |
85 padding: 16px; | |
86 } | |
87 | |
88 :host([mini]) { | |
89 width: 40px; | |
90 height: 40px; | |
91 padding: 8px; | |
92 } | |
93 | |
94 :host([disabled]) { | |
95 color: #c9c9c9; | |
96 pointer-events: none; | |
97 cursor: auto; | |
98 } | |
99 | |
100 #ripple { | |
101 pointer-events: none; | |
102 z-index: -1; | |
103 } | |
104 | |
105 #shadow { | |
106 border-radius: inherit; | |
107 pointer-events: none; | |
108 } | |
109 | |
110 #icon { | |
111 display: block; | |
112 pointer-events: none; | |
113 } | |
114 </style> | |
115 | |
116 <template if="{{raised}}"> | |
117 <paper-shadow id="shadow" fit="" animated=""></paper-shadow> | |
118 </template> | |
119 | |
120 <!-- to position to ripple behind the icon --> | |
121 <core-icon relative="" id="icon" src="{{src}}" icon="{{icon}}"></core-icon> | |
122 | |
123 </template> | |
124 | |
125 | |
126 </polymer-element> | |
127 <script charset="utf-8" src="paper-fab-extracted.js"></script></body></html> | |
OLD | NEW |