Open In App

Onsen UI CSS Component Checkbox in List Item

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 Checkbox in List Item is used to create the checkbox in the list item using the below classes.

Onsen UI CSS Component Checkbox in List Item Classes:

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

Syntax:

<ul class="list">
  <li class="list-item list-item--tappable">
    <div class="list-item__left">
      <label class="checkbox">
        <input type="checkbox" 
               class="checkbox__input">
        <div class="checkbox__checkmark"></div>
      </label>
    </div>
     ...
  </li>
</ul>

Example 1: The following example demonstrates the Onsen UI CSS Component Checkbox in List Item.

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>
        <h1 style="color: green;">
            GeeksforGeeks
        </h1>
        <h3>
            Onsen UI CSS Component Checkbox in List Item
        </h3>
  
        <ul class="list">
            <li class="list-item list-item--tappable">
                <div class="list-item__left">
                    <label class="checkbox">
                        <input type="checkbox" id="chk" 
                               class="checkbox__input">
                        <div class="checkbox__checkmark"></div>
                    </label>
                </div>
                <label for="chk" 
                       class="list-item__center">
                    GeeksforGeeks
                </label>
            </li>
        </ul>
    </center>
</body>
</html>


Output:

 

Example 2: The following example demonstrates the Onsen UI CSS Component Checkbox in List Item.

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>
        <h1 style="color: green;">
            GeeksforGeeks
        </h1>
        <h3>
            Onsen UI CSS Component Checkbox in List Item
        </h3> <br> <br>
  
        <ul class="list">
            <li class="list-item list-item--tappable">
                <div class="list-item__left">
                    <label class="checkbox">
                        <input type="checkbox" id="chk1" 
                               class="checkbox__input"
                               name="abc">
                        <div class="checkbox__checkmark"></div>
                    </label>
                </div>
                <label for="chk1" 
                       class="list-item__center">
                    Java
                </label>
            </li>
  
            <li class="list-item list-item--tappable">
                <div class="list-item__left">
                    <label class="checkbox">
                        <input type="checkbox" id="chk2" 
                               class="checkbox__input"
                               name="abc" checked>
                        <div class="checkbox__checkmark"></div>
                    </label>
                </div>
                <label for="chk2" 
                       class="list-item__center">
                    Python
                </label>
            </li>
  
            <li class="list-item list-item--tappable">
                <div class="list-item__left">
                    <label class="checkbox">
                        <input type="checkbox" id="chk3" 
                               class="checkbox__input"
                               name="abc"disabled>
                        <div class="checkbox__checkmark"></div>
                    </label>
                </div>
                <label for="chk3" 
                       class="list-item__center">
                    Disabled checkbox
                </label>
            </li>
        </ul>
    </center>
</body>
</html>


Output:

 

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



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