| 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="../paper-material/paper-material.html"> | |
| 11 <link rel="import" href="../paper-ripple/paper-ripple.html"> | |
| 12 <link rel="import" href="../paper-behaviors/paper-button-behavior.html"> | |
| 13 | |
| 14 <!-- | |
| 15 | |
| 16 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h
tml">Buttons</a> | |
| 17 | |
| 18 `paper-button` is a button. When the user touches the button, a ripple effect em
anates | |
| 19 from the point of contact. It may be flat or raised. A raised button is styled w
ith a | |
| 20 shadow. | |
| 21 | |
| 22 Example: | |
| 23 | |
| 24 <paper-button>flat button</paper-button> | |
| 25 <paper-button raised>raised button</paper-button> | |
| 26 <paper-button noink>No ripple effect</paper-button> | |
| 27 | |
| 28 You may use custom DOM in the button body to create a variety of buttons. For ex
ample, to | |
| 29 create a button with an icon and some text: | |
| 30 | |
| 31 <paper-button> | |
| 32 <core-icon icon="favorite"></core-icon> | |
| 33 custom button content | |
| 34 </paper-button> | |
| 35 | |
| 36 ### Styling | |
| 37 | |
| 38 Style the button with CSS as you would a normal DOM element. | |
| 39 | |
| 40 /* make #my-button green with yellow text */ | |
| 41 #my-button { | |
| 42 background: green; | |
| 43 color: yellow; | |
| 44 } | |
| 45 | |
| 46 By default, the ripple is the same color as the foreground at 25% opacity. You m
ay | |
| 47 customize the color using this selector: | |
| 48 | |
| 49 /* make #my-button use a blue ripple instead of foreground color */ | |
| 50 #my-button::shadow paper-ripple { | |
| 51 color: blue; | |
| 52 } | |
| 53 | |
| 54 The opacity of the ripple is not customizable via CSS. | |
| 55 | |
| 56 The following custom properties and mixins are also available for styling: | |
| 57 | |
| 58 Custom property | Description | Default | |
| 59 ----------------|-------------|---------- | |
| 60 `--paper-button-flat-focus-color` | Background color of a focused flat button |
`--paper-grey-200` | |
| 61 `--paper-button` | Mixin applied to the button | `{}` | |
| 62 `--paper-button-disabled` | Mixin applied to the disabled button | `{}` | |
| 63 | |
| 64 @demo demo/index.html | |
| 65 --> | |
| 66 | |
| 67 </head><body><dom-module id="paper-button"> | |
| 68 | |
| 69 <style> | |
| 70 | |
| 71 :host { | |
| 72 display: inline-block; | |
| 73 position: relative; | |
| 74 box-sizing: border-box; | |
| 75 min-width: 5.14em; | |
| 76 margin: 0 0.29em; | |
| 77 background: transparent; | |
| 78 text-align: center; | |
| 79 font: inherit; | |
| 80 text-transform: uppercase; | |
| 81 outline: none; | |
| 82 border-radius: 3px; | |
| 83 -moz-user-select: none; | |
| 84 -ms-user-select: none; | |
| 85 -webkit-user-select: none; | |
| 86 user-select: none; | |
| 87 cursor: pointer; | |
| 88 z-index: 0; | |
| 89 | |
| 90 @apply(--paper-button); | |
| 91 } | |
| 92 | |
| 93 .keyboard-focus { | |
| 94 font-weight: bold; | |
| 95 } | |
| 96 | |
| 97 :host([disabled]) { | |
| 98 background: #eaeaea; | |
| 99 color: #a8a8a8; | |
| 100 cursor: auto; | |
| 101 pointer-events: none; | |
| 102 | |
| 103 @apply(--paper-button-disabled); | |
| 104 } | |
| 105 | |
| 106 :host([noink]) paper-ripple { | |
| 107 display: none; | |
| 108 } | |
| 109 | |
| 110 paper-material { | |
| 111 border-radius: inherit; | |
| 112 } | |
| 113 | |
| 114 .content > ::content * { | |
| 115 text-transform: inherit; | |
| 116 } | |
| 117 | |
| 118 .content { | |
| 119 padding: 0.7em 0.57em | |
| 120 } | |
| 121 </style> | |
| 122 | |
| 123 <template> | |
| 124 | |
| 125 <paper-ripple></paper-ripple> | |
| 126 | |
| 127 <paper-material class$="[[_computeContentClass(receivedFocusFromKeyboard)]]"
elevation="[[_elevation]]" animated=""> | |
| 128 <content></content> | |
| 129 </paper-material> | |
| 130 | |
| 131 </template> | |
| 132 | |
| 133 </dom-module> | |
| 134 | |
| 135 <script src="paper-button-extracted.js"></script></body></html> | |
| OLD | NEW |