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">Buttons</a> | |
12 | |
13 `paper-button` is a button. When the user touches the button, a ripple effect em
anates | |
14 from the point of contact. It may be flat or raised. A raised button is styled w
ith a | |
15 shadow. | |
16 | |
17 Example: | |
18 | |
19 <paper-button>flat button</paper-button> | |
20 <paper-button raised>raised button</paper-button> | |
21 <paper-button noink>No ripple effect</paper-button> | |
22 | |
23 You may use custom DOM in the button body to create a variety of buttons. For ex
ample, to | |
24 create a button with an icon and some text: | |
25 | |
26 <paper-button> | |
27 <core-icon icon="favorite"></core-icon> | |
28 custom button content | |
29 </paper-button> | |
30 | |
31 Styling | |
32 ------- | |
33 | |
34 Style the button with CSS as you would a normal DOM element. | |
35 | |
36 /* make #my-button green with yellow text */ | |
37 #my-button { | |
38 background: green; | |
39 color: yellow; | |
40 } | |
41 | |
42 By default, the ripple is the same color as the foreground at 25% opacity. You m
ay | |
43 customize the color using this selector: | |
44 | |
45 /* make #my-button use a blue ripple instead of foreground color */ | |
46 #my-button::shadow #ripple { | |
47 color: blue; | |
48 } | |
49 | |
50 The opacity of the ripple is not customizable via CSS. | |
51 | |
52 @element paper-button | |
53 @extends paper-button-base | |
54 @status unstable | |
55 --><html><head><link href="../polymer/polymer.html" rel="import"> | |
56 <link href="../paper-shadow/paper-shadow.html" rel="import"> | |
57 | |
58 <link href="paper-button-base.html" rel="import"> | |
59 | |
60 </head><body><polymer-element name="paper-button" extends="paper-button-base" at
tributes="raised recenteringTouch fill" role="button" assetpath=""> | |
61 | |
62 <template> | |
63 | |
64 <style> | |
65 | |
66 :host { | |
67 display: inline-block; | |
68 position: relative; | |
69 box-sizing: border-box; | |
70 min-width: 5.14em; | |
71 margin: 0 0.29em; | |
72 background: transparent; | |
73 text-align: center; | |
74 font: inherit; | |
75 text-transform: uppercase; | |
76 outline: none; | |
77 border-radius: 3px; | |
78 -moz-user-select: none; | |
79 -ms-user-select: none; | |
80 -webkit-user-select: none; | |
81 user-select: none; | |
82 cursor: pointer; | |
83 z-index: 0; | |
84 } | |
85 | |
86 :host([disabled]) { | |
87 background: #eaeaea; | |
88 color: #a8a8a8; | |
89 cursor: auto; | |
90 pointer-events: none; | |
91 } | |
92 | |
93 ::content * { | |
94 text-transform: inherit; | |
95 } | |
96 | |
97 #shadow { | |
98 border-radius: inherit; | |
99 } | |
100 | |
101 #ripple { | |
102 pointer-events: none; | |
103 z-index: -1; | |
104 } | |
105 | |
106 .button-content { | |
107 padding: 0.7em 0.57em | |
108 } | |
109 | |
110 polyfill-next-selector { content: '.button-content > a'; } | |
111 ::content > a { | |
112 height: 100%; | |
113 padding: 0.7em 0.57em; | |
114 /* flex */ | |
115 -ms-flex: 1 1 0.000000001px; | |
116 -webkit-flex: 1; | |
117 flex: 1; | |
118 -webkit-flex-basis: 0.000000001px; | |
119 flex-basis: 0.000000001px; | |
120 } | |
121 | |
122 </style> | |
123 | |
124 <template if="{{raised}}"> | |
125 <paper-shadow id="shadow" fit="" animated=""></paper-shadow> | |
126 </template> | |
127 | |
128 <!-- this div is needed to position the ripple behind text content --> | |
129 <div class="button-content" relative="" layout="" horizontal="" center-cente
r=""> | |
130 <content></content> | |
131 </div> | |
132 | |
133 </template> | |
134 | |
135 | |
136 </polymer-element> | |
137 <script charset="utf-8" src="paper-button-extracted.js"></script></body></html> | |
OLD | NEW |