Open In App

Onsen UI CSS Component Material Checkbox

Improve
Improve
Like Article
Like
Save
Share
Report

Onsen UI CSS is used to create beautiful HTML components. It is one of the most efficient ways to create HTML5 hybrid components that are compatible with both mobile and desktop.

Checkboxes are used for instances where a user may wish to select multiple options, such as in the instance of a “check all that apply” question, in forms. Onsen UI CSS Component Material Checkbox is used to create the material checkbox in Onsen UI using the below classes.

Onsen UI CSS Component Material Checkbox Classes:

  • checkbox–material: This class is used to create the material checkbox.
  • checkbox__input: This class is used to create the checkbox input.
  • checkbox–material__input: This class is used to create the material checkbox input.
  • checkbox__checkmark: This class is used to create the checkbox checkmark.
  • checkbox–material__checkmark: This class is used to create the material type checkbox checkmark.

Syntax:

<label class="checkbox checkbox--material">
  <input type="checkbox" class="checkbox__input 
                           checkbox--material__input">
  <div class="checkbox__checkmark 
                checkbox--material__checkmark">
  </div>
  ...
</label>

Example 1: The following example demonstrates the Onsen UI CSS Component Material Checkbox.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <!-- CDN links of Onsen UI library -->
    <link rel="stylesheet" href=
    <link rel="stylesheet" href=
    <script src=
    </script>
</head>
  
<body>
    <center>
        <h2 style="color: green;">
            GeeksforGeeks
        </h2>
        <strong>
            Onsen UI CSS Component Material Checkbox
        </strong> <br> <br>
  
        <label class="checkbox checkbox--material">
            <input type="checkbox" 
                   class="checkbox__input 
                          checkbox--material__input">
            <div class="checkbox__checkmark 
                        checkbox--material__checkmark">
            </div>
            GeeksforGeeks
        </label>
    </center>
</body>
  
</html>


Output:

 

Example 2: The following example demonstrates the Onsen UI CSS Component Material Checkbox.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <!-- CDN links of Onsen UI library -->
    <link rel="stylesheet" href=
    <link rel="stylesheet" href=
    <script src=
    </script>
</head>
  
<body>
    <center>
        <h2 style="color: green;">
            GeeksforGeeks
        </h2>
        <strong>
            Onsen UI CSS Component Material Checkbox
        </strong> <br> <br>
  
        <label class="checkbox checkbox--material">
            <input type="checkbox" 
                   class="checkbox__input 
                          checkbox--material__input">
            <div class="checkbox__checkmark 
                        checkbox--material__checkmark">
            </div>
            Java
        </label>
  
        <label class="checkbox checkbox--material">
            <input type="checkbox" 
                   class="checkbox__input 
                          checkbox--material__input" 
                    checked>
            <div class="checkbox__checkmark 
                        checkbox--material__checkmark">
            </div>
            C++
        </label>
  
        <label class="checkbox checkbox--material">
            <input type="checkbox" 
                   class="checkbox__input 
                          checkbox--material__input" 
                    disabled>
            <div class="checkbox__checkmark 
                        checkbox--material__checkmark">
            </div>
            Python
        </label>
    </center>
</body>
  
</html>


Output:

 

Reference: https://onsen.io/v2/api/css.html#checkbox-category



Last Updated : 22 Jun, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads