Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1476)

Side by Side Diff: third_party/polymer/v0_8/components/paper-button/paper-button.html

Issue 1082403004: Import Polymer 0.8 and several key elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also remove polymer/explainer Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 -->
10
11 <!--
12
13 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h tml">Buttons</a>
14
15 `paper-button` is a button. When the user touches the button, a ripple effect em anates
16 from the point of contact. It may be flat or raised. A raised button is styled w ith a
17 shadow.
18
19 Example:
20
21 <paper-button>flat button</paper-button>
22 <paper-button raised>raised button</paper-button>
23 <paper-button noink>No ripple effect</paper-button>
24
25 You may use custom DOM in the button body to create a variety of buttons. For ex ample, to
26 create a button with an icon and some text:
27
28 <paper-button>
29 <core-icon icon="favorite"></core-icon>
30 custom button content
31 </paper-button>
32
33 ## Styling
34
35 Style the button with CSS as you would a normal DOM element.
36
37 /* make #my-button green with yellow text */
38 #my-button {
39 background: green;
40 color: yellow;
41 }
42
43 By default, the ripple is the same color as the foreground at 25% opacity. You m ay
44 customize the color using this selector:
45
46 /* make #my-button use a blue ripple instead of foreground color */
47 #my-button::shadow paper-ripple {
48 color: blue;
49 }
50
51 The opacity of the ripple is not customizable via CSS.
52
53 -->
54
55 <link rel="import" href="../polymer/polymer.html">
56 <link rel="import" href="../paper-card/paper-card.html">
57 <link rel="import" href="../paper-ripple/paper-ripple.html">
58
59 <link rel="import" href="../paper-behaviors/paper-button-behavior.html">
60
61 <dom-module id="paper-button">
62
63 <style>
64
65 :host {
66 display: inline-block;
67 position: relative;
68 box-sizing: border-box;
69 min-width: 5.14em;
70 margin: 0 0.29em;
71 background: transparent;
72 text-align: center;
73 font: inherit;
74 text-transform: uppercase;
75 outline: none;
76 border-radius: 3px;
77 -moz-user-select: none;
78 -ms-user-select: none;
79 -webkit-user-select: none;
80 user-select: none;
81 cursor: pointer;
82 z-index: 0;
83 }
84
85 :host([disabled]) {
86 background: #eaeaea;
87 color: #a8a8a8;
88 cursor: auto;
89 pointer-events: none;
90 }
91
92 :host([noink]) paper-ripple {
93 display: none;
94 }
95
96 paper-card {
97 border-radius: inherit;
98 }
99
100 .content > ::content * {
101 text-transform: inherit;
102 }
103
104 .content {
105 padding: 0.7em 0.57em
106 }
107 </style>
108
109 <template>
110
111 <paper-ripple></paper-ripple>
112
113 <paper-card class="content" elevation="[[_elevation]]" animated>
114 <content></content>
115 </paper-card>
116
117 </template>
118
119 <script>
120
121 Polymer({
122
123 behaviors: [
124 Polymer.PaperButtonBehavior
125 ],
126
127 properties: {
128
129 /**
130 * If true, the button should be styled with a shadow.
131 *
132 * @attribute raised
133 * @type boolean
134 * @default false
135 */
136 raised: {
137 type: Boolean,
138 reflectToAttribute: true,
139 value: false,
140 observer: '_buttonStateChanged'
141 }
142
143 },
144
145 ready: function() {
146 if (!this.hasAttribute('role')) {
147 this.setAttribute('role', 'button');
148 }
149 },
150
151 _buttonStateChanged: function() {
152 this._calculateElevation();
153 }
154
155 });
156
157 </script>
158
159 </dom-module>
160
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698