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.github.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/CONTRIBUTORS
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/PATENTS
11 <link rel=
"import" href=
"../polymer/polymer.html">
12 <link rel=
"import" href=
"../paper-material/paper-material.html">
13 <link rel=
"import" href=
"../paper-ripple/paper-ripple.html">
14 <link rel=
"import" href=
"../paper-behaviors/paper-button-behavior.html">
18 Material Design: <a href="http://www.google.com/design/spec/components/buttons.html">Buttons</a>
20 `paper-button` is a button. When the user touches the button, a ripple effect emanates
21 from the point of contact. It may be flat or raised. A raised button is styled with a
26 <paper-button>flat button</paper-button>
27 <paper-button raised>raised button</paper-button>
28 <paper-button noink>No ripple effect</paper-button>
29 <paper-button toggles>toggle-able button</paper-button>
31 A button that has `toggles` true will remain `active` after being clicked (and
32 will have an `active` attribute set). For more information, see the `Polymer.IronButtonState`
35 You may use custom DOM in the button body to create a variety of buttons. For example, to
36 create a button with an icon and some text:
39 <iron-icon icon="favorite"></iron-icon>
45 Style the button with CSS as you would a normal DOM element.
47 /* make #my-button green with yellow text */
53 By default, the ripple is the same color as the foreground at 25% opacity. You may
54 customize the color using this selector:
56 /* make #my-button use a blue ripple instead of foreground color */
57 #my-button::shadow paper-ripple {
61 The opacity of the ripple is not customizable via CSS.
63 The following custom properties and mixins are also available for styling:
65 Custom property | Description | Default
66 ----------------|-------------|----------
67 `--paper-button-flat-focus-color` | Background color of a focused flat button | `--paper-grey-200`
68 `--paper-button` | Mixin applied to the button | `{}`
69 `--paper-button-disabled` | Mixin applied to the disabled button | `{}`
74 <dom-module id=
"paper-button">
79 display: inline-block;
81 box-sizing: border-box;
84 background: transparent;
87 text-transform: uppercase;
90 -moz-user-select: none;
91 -ms-user-select: none;
92 -webkit-user-select: none;
97 @apply(--paper-button);
108 pointer-events: none;
110 @apply(--paper-button-disabled);
113 :host([noink]) paper-ripple {
118 border-radius: inherit;
121 .content
> ::content * {
122 text-transform: inherit;
126 padding:
0.7em
0.57em
132 <paper-ripple></paper-ripple>
134 <paper-material class$=
"[[_computeContentClass(receivedFocusFromKeyboard)]]" elevation=
"[[_elevation]]" animated
>
149 Polymer
.PaperButtonBehavior
155 * If true, the button should be styled with a shadow.
159 reflectToAttribute
: true,
161 observer
: '_calculateElevation'
165 _calculateElevation: function() {
169 Polymer
.PaperButtonBehaviorImpl
._calculateElevation
.apply(this);
173 _computeContentClass: function(receivedFocusFromKeyboard
) {
174 var className
= 'content ';
175 if (receivedFocusFromKeyboard
) {
176 className
+= ' keyboard-focus';