OLD | NEW |
1 <!-- | 1 <!-- |
2 @license | 2 @license |
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 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.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
7 Code distributed by Google as part of the polymer project is also | 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.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --><html><head><link rel="import" href="../polymer/polymer.html"> | 9 --><html><head><link rel="import" href="../polymer/polymer.html"> |
10 <link rel="import" href="../paper-ripple/paper-ripple.html"> | 10 <link rel="import" href="../paper-ripple/paper-ripple.html"> |
11 <link rel="import" href="../paper-styles/default-theme.html"> | 11 <link rel="import" href="../paper-styles/default-theme.html"> |
12 <link rel="import" href="../paper-behaviors/paper-radio-button-behavior.html"> | 12 <link rel="import" href="../paper-behaviors/paper-radio-button-behavior.html"> |
13 | 13 |
14 <!-- | 14 <!-- |
| 15 |
15 `paper-checkbox` is a button that can be either checked or unchecked. User | 16 `paper-checkbox` is a button that can be either checked or unchecked. User |
16 can tap the checkbox to check or uncheck it. Usually you use checkboxes | 17 can tap the checkbox to check or uncheck it. Usually you use checkboxes |
17 to allow user to select multiple options from a set. If you have a single | 18 to allow user to select multiple options from a set. If you have a single |
18 ON/OFF option, avoid using a single checkbox and use `paper-toggle-button` | 19 ON/OFF option, avoid using a single checkbox and use `paper-toggle-button` |
19 instead. | 20 instead. |
20 | 21 |
21 Example: | 22 Example: |
22 | 23 |
23 <paper-checkbox>label</paper-checkbox> | 24 <paper-checkbox>label</paper-checkbox> |
24 | 25 |
25 <paper-checkbox checked> label</paper-checkbox> | 26 <paper-checkbox checked> label</paper-checkbox> |
26 | 27 |
27 Styling a checkbox: | 28 ### Styling |
28 | 29 |
29 <style is="x-style"> | 30 The following custom properties and mixins are available for styling: |
30 * { | |
31 /* Unhecked state colors. */ | |
32 --paper-checkbox-unchecked-color: #5a5a5a; | |
33 --paper-checkbox-unchecked-ink-color: #5a5a5a; | |
34 | 31 |
35 /* Checked state colors. */ | 32 Custom property | Description | Default |
36 --paper-checkbox-checked-color: #009688; | 33 ----------------|-------------|---------- |
37 --paper-checkbox-checked-ink-color: #009688; | 34 `--paper-checkbox-unchecked-color` | Checkbox color when the input is not checke
d | `--primary-text-color` |
| 35 `--paper-checkbox-unchecked-ink-color` | Selected/focus ripple color when the in
put is not checked | `--primary-text-color` |
| 36 `--paper-checkbox-checked-color` | Checkbox color when the input is checked | `-
-default-primary-color` |
| 37 `--paper-checkbox-checked-ink-color` | Selected/focus ripple color when the inpu
t is checked | `--default-primary-color` |
| 38 `--paper-checkbox-label-color` | Label color | `--primary-text-color` |
| 39 |
| 40 @demo demo/index.html |
| 41 --> |
| 42 |
| 43 <style is="custom-style"> |
| 44 :root { |
| 45 --paper-checkbox-unchecked-color: var(--primary-text-color); |
| 46 --paper-checkbox-unchecked-ink-color: var(--primary-text-color); |
| 47 |
| 48 --paper-checkbox-checked-color: var(--default-primary-color); |
| 49 --paper-checkbox-checked-ink-color: var(--default-primary-color); |
| 50 |
| 51 --paper-checkbox-label-color: var(--primary-text-color); |
38 } | 52 } |
39 </style> | 53 </style> |
40 | 54 |
41 @group Paper Elements | |
42 @class paper-checkbox | |
43 --> | |
44 | |
45 </head><body><dom-module id="paper-checkbox"> | 55 </head><body><dom-module id="paper-checkbox"> |
46 <style is="x-style"> | |
47 * { | |
48 --paper-checkbox-unchecked-color: var(--primary-text-color); | |
49 --paper-checkbox-unchecked-ink-color: var(--primary-text-color); | |
50 | |
51 --paper-checkbox-checked-color: var(--default-primary-color); | |
52 --paper-checkbox-checked-ink-color: var(--default-primary-color); | |
53 } | |
54 </style> | |
55 | |
56 <link rel="import" type="css" href="paper-checkbox.css"> | 56 <link rel="import" type="css" href="paper-checkbox.css"> |
57 | 57 |
58 <template> | 58 <template> |
59 | 59 |
60 <div id="checkboxContainer"> | 60 <div id="checkboxContainer"> |
61 <paper-ripple id="ink" class="circle" recenters="" checked$="[[checked]]">
</paper-ripple> | 61 <paper-ripple id="ink" class="circle" center="" checked$="[[checked]]"></p
aper-ripple> |
62 <div id="checkbox" class$="[[_computeCheckboxClass(checked)]]"> | 62 <div id="checkbox" class$="[[_computeCheckboxClass(checked)]]"> |
63 <div id="checkmark" class$="[[_computeCheckmarkClass(checked)]]"></div> | 63 <div id="checkmark" class$="[[_computeCheckmarkClass(checked)]]"></div> |
64 </div> | 64 </div> |
65 </div> | 65 </div> |
66 | 66 |
67 <div id="checkboxLabel" aria-hidden="true"><content></content></div> | 67 <div id="checkboxLabel" aria-hidden="true"><content></content></div> |
68 | 68 |
69 </template> | 69 </template> |
70 </dom-module> | |
71 | 70 |
| 71 </dom-module> |
72 <script src="paper-checkbox-extracted.js"></script></body></html> | 72 <script src="paper-checkbox-extracted.js"></script></body></html> |
OLD | NEW |