Index: ui/webui/resources/cr_elements/cr_toggle_button/cr-toggle-button.js |
diff --git a/ui/webui/resources/cr_elements/cr_toggle_button/cr-toggle-button.js b/ui/webui/resources/cr_elements/cr_toggle_button/cr-toggle-button.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2564faace8d3e31a55f14df339ba92fde0b5f58b |
--- /dev/null |
+++ b/ui/webui/resources/cr_elements/cr_toggle_button/cr-toggle-button.js |
@@ -0,0 +1,47 @@ |
+/* Copyright 2015 The Chromium Authors. All rights reserved. |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. */ |
+ |
+/** |
+ * @fileoverview |
Jeremy Klein
2015/02/09 19:20:25
Should we make it the convention to always put the
michaelpg
2015/02/09 22:11:19
I think that's the right thing to do for the sake
|
+ * `cr-toggle-button` provides a switch the user can toggle on or off by |
+ * tapping or by dragging. Wraps a `paper-toggle-button`. |
+ * |
+ * Example: |
+ * |
+ * <cr-toggle-button></cr-toggle-button> |
+ * |
+ * @element cr-toggle-button |
+ */ |
+Polymer({ |
+ publish: { |
+ /** |
+ * Gets or sets the state. `true` is checked and `false` is unchecked. |
+ * |
+ * @attribute checked |
+ * @type boolean |
+ * @default false |
+ */ |
+ checked: { |
+ value: false, |
+ reflect: true, |
+ }, |
+ |
+ /** |
+ * If true, the toggle button is disabled. |
+ * |
+ * @attribute disabled |
+ * @type boolean |
+ * @default false |
+ */ |
+ disabled: { |
+ value: false, |
+ reflect: true, |
+ }, |
+ }, |
+ |
+ ready: function() { |
+ this.$['toggle-button'].addEventListener('change', |
+ this.$.events.forwardEvent); |
stevenjb
2015/02/09 18:33:00
Question: Is the <cr-events> element useful withou
michaelpg
2015/02/09 22:11:19
no, yes, done
|
+ }, |
+}); |