Kmenger has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/193880

Change subject: CheckboxInputWidget: Add description and example
......................................................................

CheckboxInputWidget: Add description and example

Change-Id: I5e44046f1811a4458c4a811c9a1c3b1dd29254df
---
M src/widgets/CheckboxInputWidget.js
1 file changed, 32 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/80/193880/1

diff --git a/src/widgets/CheckboxInputWidget.js 
b/src/widgets/CheckboxInputWidget.js
index f1a4add..176083a 100644
--- a/src/widgets/CheckboxInputWidget.js
+++ b/src/widgets/CheckboxInputWidget.js
@@ -1,12 +1,41 @@
 /**
- * Checkbox input widget.
+ * CheckboxInputWidgets, like HTML checkboxes, can be selected and/or 
configured with a value.
+ *  Note that these {@link OO.ui.InputWidget input widgets} are best laid out
+ * in {@link OO.ui.FieldLayout field layouts} that use the {@link 
OO.ui.FieldLayout#align inline}
+ * alignment. For more information, please see the [OOjs UI documentation on 
MediaWiki][1].
+ *
+ *     @example
+ *     // An example of selected, unselected, and disabled checkbox inputs
+ *     var checkbox1=new OO.ui.CheckboxInputWidget({
+ *          value: 'a',
+ *          selected: true
+ *     });
+ *     var checkbox2=new OO.ui.CheckboxInputWidget({
+ *         value: 'b'
+ *     });
+ *     var checkbox3=new OO.ui.CheckboxInputWidget( {
+ *         value:'c',
+ *         disabled: true
+ *     } );
+ *     // Create a fieldset layout with fields for each checkbox.
+ *     var fieldset = new OO.ui.FieldsetLayout( {
+ *         label: 'Checkboxes'
+ *     } );
+ *     fieldset.addItems( [
+ *         new OO.ui.FieldLayout( checkbox1, {label : 'Selected checkbox', 
align : 'inline'}),
+ *         new OO.ui.FieldLayout( checkbox2, {label : 'Unselected checkbox', 
align : 'inline'}),
+ *         new OO.ui.FieldLayout( checkbox3, {label : 'Disabled checkbox', 
align : 'inline'}),
+ *     ] );
+ *     $( 'body' ).append( fieldset.$element );
+ *
+ * [1]: https://www.mediawiki.org/wiki/OOjs_UI/Widgets/Inputs
  *
  * @class
  * @extends OO.ui.InputWidget
  *
  * @constructor
  * @param {Object} [config] Configuration options
- * @cfg {boolean} [selected=false] Whether the checkbox is initially selected
+ * @cfg {boolean} [selected=false] Select the checkbox initially. By default, 
the checkbox is not selected.
  */
 OO.ui.CheckboxInputWidget = function OoUiCheckboxInputWidget( config ) {
        // Configuration initialization
@@ -50,7 +79,7 @@
 /**
  * Set selection state of this checkbox.
  *
- * @param {boolean} state Whether the checkbox is selected
+ * @param {boolean} state `true` for selected
  * @chainable
  */
 OO.ui.CheckboxInputWidget.prototype.setSelected = function ( state ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/193880
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e44046f1811a4458c4a811c9a1c3b1dd29254df
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Kmenger <kmen...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to