Open In App

Onsen UI Popover CSS Components

In this article, we will learn how to include popover using Onsen UI. Onsen UI is an HTML5 framework that allows you to design distinctive and usable user interfaces for free (UI). It also makes UI creation easier, enabling programmers to focus on the core of the product. Onsen UI is a complex set of user interface components designed specifically for mobile apps, with ready-to-use features that follow native iOS and Android design standards. 

Onsen UI was created with AngularJS in mind, but it can also be used with jQuery or any other framework. Onsen UI is a PhoneGap and Cordova JavaScript Framework.



Popovers are used to notify the user about what notes a user should know before he proceeds further. It can also be used as a notification, like supposing the user has no idea what is going on in any particular section, then this popover can help or guide him/her.

Popover CSS Components:



Classes:

Basic Popover: This component is used to provide a basic popover at the bottom of the page.

Popover(top): This component is used to provide a popover at the top of the page.

Popover(left): This component is used to provide a popover at the left-most corner of the webpage.

Popover(right): This component is used to provide a popover at the right-most corner of the webpage.

Material Popover: This component is used to provide a popover of material type and their associated classes are listed below.

Syntax:

<element-name class="class-name">...</element-name>

Example 1: In the below code, we will make use of the above classes to demonstrate the use of the popover component.




<!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 Popover CSS Components
    </h3> <br> <br>
    <div class="popover-mask"></div>
    <div class="popover popover--bottom" 
      style="bottom: 20px; left: 65px;">
      <div class="popover__arrow popover--bottom__arrow" 
        style="left: 110px;">
      </div>
      <div class="popover__content popover--bottom__content">
        <div style="text-align:center;opacity:0.8;
            margin-top:40px">
          Content
        </div>
      </div>
    </div>
  </center>
</body>
</html>

Output:

 

Example 2: In the below code, we will make use of the above classes to demonstrate the use of the popover component.




<!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 Popover CSS Components
    </h3> <br> <br>
    <div class="popover-mask"></div>
    <div class="popover popover--right" 
      style="top: 20px; right: 20px;">
      <div class="popover__arrow popover--right__arrow" 
        style="bottom: 50px;">
      </div>
      <div class="popover__content popover--right__content">
        <div style="text-align: center; opacity: 0.8; 
                margin-top: 40px">
          Content
        </div>
      </div>
    </div>
  </center>
</body>
</html>

Output:

 

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


Article Tags :