Open In App

Onsen UI CSS Component Expandable List

Last Updated : 01 Sep, 2022
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.

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

Onsen UI CSS Component Expandable List Classes:

  • list-item–expandable: This class is used to create the expandable list item.
  • list-item–expanded: This class is used to expand the list item.

Syntax:

<ul class="list">
  <li class="list-item list-item--expandable 
               list-item--expanded">
     ....
  </li>
</ul>

Example 1: The following example demonstrates the Onsen UI CSS Component Expandable List.

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 Expandable List
        </h3>
  
        <ul class="list">
            <li class="list-item list-item--expandable 
                       list-item--expanded">
                <div class="list-item__top">
                    <div class="list-item__center">
                        GeeksforGeeks
                    </div>
                    <div class="list-item__right">
                        <span class="list-item__expand-chevron"></span>
                    </div>
                </div>
                <div class="list-item__expandable-content">
                    A Computer Science portal for geeks. 
                    It contains well written, well 
                    thought and well explained computer 
                    science and programming articles.
                </div>
            </li>
        </ul>
    </center>
</body>
</html>


Output:

 

Example 2: The following example demonstrates the Onsen UI CSS Component Expandable List.

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 Expandable List
        </h3>
  
        <ul class="list">
            <li class="list-item list-item--expandable 
                       list-item--expanded">
                <div class="list-item__top">
                    <div class="list-item__center">
                        GeeksforGeeks image
                    </div>
                    <div class="list-item__right">
                        <span class="list-item__expand-chevron"></span>
                    </div>
                </div>
                <div class="list-item__expandable-content">
                    <img src=
                </div>
            </li>
        </ul>
    </center>
</body>
</html>


Output:

 

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



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads