Open In App

Onsen UI CSS Component Switch in List Item

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.

Lists are used to store data or information on web pages in ordered or unordered form. Onsen UI CSS Component Switch in List Item is used to create the switch in the list using the below classes.



 Onsen UI CSS Component Switch in List Item Classes:

Syntax:



<ul class="list">
  <li class="list-item">
    ...
    <div class="list-item__right">
      <label class="switch">
        <input type="checkbox" 
               class="switch__input">
        <div class="switch__toggle">
          <div class="switch__handle"></div>
        </div>
      </label>
    </div>
  </li>
</ul>

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




<!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 Switch in List Item
        </strong> <br> <br>
  
        <ul class="list">
            <li class="list-item list-item__center">
                <label class="switch">
                    <input type="checkbox" 
                           class="switch__input">
                    <div class="switch__toggle">
                        <div class="switch__handle">
                        </div>
                    </div>
                </label>
            </li>
        </ul>
    </center>
</body>
  
</html>

Output:

 

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




<!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 Switch in List Item
        </strong> <br> <br>
  
        <div class="list-title 
                    list-title--material">
            This is list Title
        </div>
        <ul class="list">
            <li class="list-item">
              <div class="list-item__center">
                GeeksforGeeks
              </div>
              <div class="list-item__right">
                <label class="switch">
                  <input type="checkbox" 
                         class="switch__input">
                  <div class="switch__toggle">
                    <div class="switch__handle">
                    </div>
                  </div>
                </label>
              </div>
            </li>
              
            <li class="list-item">
              <div class="list-item__center">
                Onsen UI
              </div>
              <div class="list-item__right">
                <label class="switch">
                  <input type="checkbox" 
                         class="switch__input">
                  <div class="switch__toggle">
                    <div class="switch__handle">
                    </div>
                  </div>
                </label>
              </div>
            </li>
          </ul>
    </center>
</body>
  
</html>

Output:

 

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


Article Tags :