• Home
Name Date Size #Lines LOC

..--

demo/03-May-2024-139118

test/03-May-2024-13494

.bower.jsonD03-May-20241.6 KiB5050

.gitignoreD03-May-202417 21

.travis.ymlD03-May-2024789 2423

CONTRIBUTING.mdD03-May-20243.4 KiB7839

README.mdD03-May-20242.9 KiB9558

bower.jsonD03-May-20241.3 KiB4241

index.htmlD03-May-2024867 2712

paper-button.htmlD03-May-20245.4 KiB17986

README.md

1
2<!---
3
4This README is automatically generated from the comments in these files:
5paper-button.html
6
7Edit those files, and our readme bot will duplicate them over here!
8Edit this file, and the bot will squash your changes :)
9
10The bot does some handling of markdown. Please file a bug if it does the wrong
11thing! https://github.com/PolymerLabs/tedium/issues
12
13-->
14
15[![Build status](https://travis-ci.org/PolymerElements/paper-button.svg?branch=master)](https://travis-ci.org/PolymerElements/paper-button)
16
17_[Demo and API docs](https://elements.polymer-project.org/elements/paper-button)_
18
19
20##&lt;paper-button&gt;
21
22Material 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
25from the point of contact. It may be flat or raised. A raised button is styled with a
26shadow.
27
28Example:
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
37A button that has `toggles` true will remain `active` after being clicked (and
38will have an `active` attribute set). For more information, see the `Polymer.IronButtonState`
39behavior.
40
41You may use custom DOM in the button body to create a variety of buttons. For example, to
42create 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
51To use `paper-button` as a link, wrap it in an anchor tag. Since `paper-button` will already
52receive focus, you may want to prevent the anchor tag from receiving focus as well by setting
53its 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
63Style the button with CSS as you would a normal DOM element.
64
65```css
66paper-button.fancy {
67  background: green;
68  color: yellow;
69}
70
71paper-button.fancy:hover {
72  background: lime;
73}
74
75paper-button[disabled],
76paper-button[toggles][active] {
77  background: red;
78}
79```
80
81By default, the ripple is the same color as the foreground at 25% opacity. You may
82customize the color using the `--paper-button-ink-color` custom property.
83
84The 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