Skip to content
Related Articles

Related Articles

Onsen UI CSS Component Basic Checkbox

View Discussion
Improve Article
Save Article
  • Last Updated : 29 Jun, 2022

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 Basic Checkbox is used to create the basic checkbox using the Onsen UI Checkbox classes.

Onsen UI CSS Component Basic Checkbox Classes:

  • checkbox: This class is used to create the checkbox.
  • checkbox__input: This class is used to create the checkbox input.
  • checkbox__checkmark: This class is used to create the checkbox checkmark.

Syntax:

<label class="checkbox">
  <input type="checkbox" 
           class="checkbox__input">
  <div class="checkbox__checkmark"></div>
  ...
</label>

Example 1: The following example demonstrates the Onsen UI CSS Component Basic 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 Basic Checkbox 
        </strong> <br> <br>
  
        <label class="checkbox">
            <input type="checkbox" 
                   class="checkbox__input">
            <div class="checkbox__checkmark">
            </div>
            GeeksforGeeks
        </label>
    </center>
</body>
  
</html>


Output:

 

Example 2: The following example demonstrates the Onsen UI CSS Component Basic 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 Basic Checkbox
        </strong> <br> <br>
  
        <label class="checkbox">
            <input type="checkbox" 
                   class="checkbox__input">
            <div class="checkbox__checkmark">
            </div>
            Java
        </label>
  
        <label class="checkbox">
            <input type="checkbox" 
                   class="checkbox__input" 
                    checked>
            <div class="checkbox__checkmark">
            </div>
            C++
        </label>
  
        <label class="checkbox">
            <input type="checkbox" 
                   class="checkbox__input" 
                    disabled>
            <div class="checkbox__checkmark">
            </div>
            Python
        </label>
    </center>
</body>
  
</html>


Output:

 

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


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!