Checkbox

Definition: A checkbox is an element that selects multiple options or toggle a binary choice.

Design

Add your <input> to the wrapper that contain the .checkbox class. Add a <label> label tag after the <input> tag.


                                                        
                                                        
                                                            <div class="checkbox">
                                                          <input type="checkbox" id="checkbox-example"> 
                                                          <label for="checkbox-example">Option one is this</label>
                                                        </div>
                                                        
                                                            

 

Indeterminate / mixed state

The third checkboxes state, when is between checked and unchecked, can be added by adding .mixed class to the wrapper that contain the .checkbox class. Or you can utilize the :indeterminate pseudo class (MDN Web Docs or caniuse) when manually set via JavaScript (there is no available HTML attribute for specifying it).


                                                        
                                                        
                                                            <div class="checkbox mixed">
                                                          <input type="checkbox" id="indeterminate-checkbox-example"> 
                                                          <label for="indeterminate-checkbox-example" aria-checked="mixed">indeterminate checkboxes option</label>
                                                        </div>
                                                        
                                                            

 

Secondary/outline style

For the secondary style of the checkbox just add the .checkbox-outline class to the .checkbox wrapper.


                                                        
                                                        
                                                            <div class="checkbox checkbox-outline">
                                                          <input type="checkbox" id="checkbox-outline-example"> 
                                                          <label for="checkbox-outline-example">outline/secondary checkboxes option</label>
                                                        </div>