Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Unified Diff: ui/webui/resources/cr_elements/cr_checkbox/cr_checkbox.js

Issue 909313003: Add cr-checkbox to Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to nits. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/webui/resources/cr_elements/cr_checkbox/cr_checkbox.js
diff --git a/ui/webui/resources/cr_elements/cr_checkbox/cr_checkbox.js b/ui/webui/resources/cr_elements/cr_checkbox/cr_checkbox.js
new file mode 100644
index 0000000000000000000000000000000000000000..4011c010ef042f8f68527c6707fea285a7be2539
--- /dev/null
+++ b/ui/webui/resources/cr_elements/cr_checkbox/cr_checkbox.js
@@ -0,0 +1,56 @@
+/* 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
+ * `cr-checkbox` is a button that can be either checked or unchecked. User
+ * can tap the checkbox to check or uncheck it. Usually you use checkboxes
+ * to allow user to select multiple options from a set. If you have a single
+ * ON/OFF option, avoid using a single checkbox and use `cr-toggle-button`
+ * instead.
+ *
+ * Example:
+ * <cr-checkbox></cr-checkbox>
+ * <cr-checkbox checked></cr-checkbox>
+ *
+ * @element cr-checkbox
+ */
+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},
+
+ /**
+ * The label for the checkbox.
+ *
+ * @attribute label
+ * @type string
+ * @default ''
+ */
+ label: '',
+
+ /**
+ * If true, the user cannot interact with this element.
+ *
+ * @attribute disabled
+ * @type boolean
+ * @default false
+ */
+ disabled: {value: false, reflect: true},
+ },
+
+ toggle: function() {
+ this.$.checkbox.toggle();
+ },
+
+ ready: function() {
+ this.$.events.forward(this.$.checkbox, ['change']);
+ },
+});
« no previous file with comments | « ui/webui/resources/cr_elements/cr_checkbox/cr_checkbox.html ('k') | ui/webui/resources/cr_elements_resources.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698