--- layout : 'default' css : 'checkbox' title : 'Checkbox' type : 'UI Module' ---

Checkbox

A checkbox is a ui module which indicates a user's selection of a choice.

Standard

Check Box

A standard checkbox

Static Check Box

A checkbox can function without javascript

Form Checkbox

A checkbox can be found inside a form

Submit

Variations

Radio Box

A checkbox can be formatted as a radio element. This means it is an exclusive option.

Size

A checkbox can be a different size.

Add a pro membership



Signup for our mailing list

Behavior

A checkbox can change to show a user has selected it

$('.ui.checkbox') .checkbox('enable') ;

A checkbox can change to show a user has not selected it

$('.ui.checkbox') .checkbox('disable') ;

A checkbox can toggle between states

$('.ui.checkbox') .checkbox('toggle') ;

Examples

Example of using checkbox states to alter multiple checkboxes

$('.enable.button') .on('click', function() { $(this) .parent() .nextAll('.checkbox') .checkbox('enable') ; }) ; $('.disable.button') .on('click', function() { $(this) .parent() .nextAll('.checkbox') .checkbox('disable') ; }) ; $('.toggle.button') .on('click', function() { $(this) .parent() .nextAll('.checkbox') .checkbox('toggle') ; }) ;
Enable
Disable
Toggle


Usage

Initializing

Initializing a check box

$('.ui.checkbox') .checkbox() ;

Settings

Checkbox Settings
required auto Setting to true/false will determine whether an input will allow no selection. Auto will set disallow this behavior only for radio boxes
context false A selector or jQuery object to use as a delegated event context
Callbacks
onChange None Callback after a checkbox is either disabled or enabled.
onEnable None Callback after a checkbox is enabled.
onDisable None Callback after a checkbox is disabled.
UI Module Settings
moduleName Checkbox Name used in debug logs
debug True Provides standard debug output to console
performance False Provides standard debug output to console
verbose False Provides ancillary debug output to console
namespace checkbox Event namespace. Makes sure module teardown does not effect other events attached to an element.
errors
errors : { method : 'The method you called is not defined.' }