README.md
1
2 <!---
3
4 This README is automatically generated from the comments in these files:
5 paper-button.html
6
7 Edit those files, and our readme bot will duplicate them over here!
8 Edit this file, and the bot will squash your changes :)
9
10 The bot does some handling of markdown. Please file a bug if it does the wrong
11 thing! https://github.com/PolymerLabs/tedium/issues
12
13 -->
14
15 [](https://travis-ci.org/PolymerElements/paper-button)
16
17 _[Demo and API docs](https://elements.polymer-project.org/elements/paper-button)_
18
19
20 ##<paper-button>
21
22 Material design: [Buttons](https://www.google.com/design/spec/components/buttons.html)
23
24 `paper-button` is a button. When the user touches the button, a ripple effect emanates
25 from the point of contact. It may be flat or raised. A raised button is styled with a
26 shadow.
27
28 Example:
29
30 ```html
31 <paper-button>Flat button</paper-button>
32 <paper-button raised>Raised button</paper-button>
33 <paper-button noink>No ripple effect</paper-button>
34 <paper-button toggles>Toggle-able button</paper-button>
35 ```
36
37 A button that has `toggles` true will remain `active` after being clicked (and
38 will have an `active` attribute set). For more information, see the `Polymer.IronButtonState`
39 behavior.
40
41 You may use custom DOM in the button body to create a variety of buttons. For example, to
42 create a button with an icon and some text:
43
44 ```html
45 <paper-button>
46 <iron-icon icon="favorite"></iron-icon>
47 custom button content
48 </paper-button>
49 ```
50
51 To use `paper-button` as a link, wrap it in an anchor tag. Since `paper-button` will already
52 receive focus, you may want to prevent the anchor tag from receiving focus as well by setting
53 its tabindex to -1.
54
55 ```html
56 <a href="https://www.polymer-project.org/" tabindex="-1">
57 <paper-button raised>Polymer Project</paper-button>
58 </a>
59 ```
60
61 ### Styling
62
63 Style the button with CSS as you would a normal DOM element.
64
65 ```css
66 paper-button.fancy {
67 background: green;
68 color: yellow;
69 }
70
71 paper-button.fancy:hover {
72 background: lime;
73 }
74
75 paper-button[disabled],
76 paper-button[toggles][active] {
77 background: red;
78 }
79 ```
80
81 By default, the ripple is the same color as the foreground at 25% opacity. You may
82 customize the color using the `--paper-button-ink-color` custom property.
83
84 The following custom properties and mixins are also available for styling:
85
86 | Custom property | Description | Default |
87 | --- | --- | --- |
88 | `--paper-button-ink-color` | Background color of the ripple | `Based on the button's color` |
89 | `--paper-button` | Mixin applied to the button | `{}` |
90 | `--paper-button-disabled` | Mixin applied to the disabled button. Note that you can also use the `paper-button[disabled]` selector | `{}` |
91 | `--paper-button-flat-keyboard-focus` | Mixin applied to a flat button after it's been focused using the keyboard | `{}` |
92 | `--paper-button-raised-keyboard-focus` | Mixin applied to a raised button after it's been focused using the keyboard | `{}` |
93
94
95