Open In App

Onsen UI Alert Dialog CSS Components

Onsen UI is a free HTML5 framework that enables you to create unique and practical user interfaces (UI). It also makes UI development simpler, freeing programmers to concentrate on the essential aspects of the project. Onsen UI is a sophisticated collection of user interface elements created especially for mobile apps, with features that are ready to use and adhere to native iOS and Android design standards. AngularJS was the inspiration behind the creation of Onsen UI, however, it may also be used with jQuery or any other framework.

The pre-built CSS components from Onsen UI make it simple to quickly construct flexible and attractive user interface layouts. For mobile developers, Onsen CSS Components is a web-based Topcoat theme roller that makes developing attractive UIs simpler. Alert Dialog is used to display some warning messages with pop-ups on the webpage.



Onsen UI Dialog CSS Component Alert Dialog Classes:

Syntax:



<div class="alert-dialog-mask"></div>
<div class="alert-dialog">
      <div class="alert-dialog-container">
        <div class="alert-dialog-title">
               ....
        </div>
        <div class="alert-dialog-content">
              ....
        </div>
        <div class="alert-dialog-footer">
               <button class="alert-dialog-button">. .</button>
        </div>
      </div>
</div>

Example 1: The below code example demonstrates the implementation of an alert dialog.




<!DOCTYPE html>
<html>
  
<head>
    <link rel="stylesheet" href=
    <link rel="stylesheet" href=
</head>
  
<body>
    <div style="margin:3rem;font-family:Roboto, sans-serif;">
        <h1 style="color:green;">GeeksforGeeks</h1>
        <h3 style="margin-top:-1.5rem;">
            Onsen UI Alert Dialog CSS Components
          </h3>
    </div>
    <div class="alert-dialog-mask"></div>
    <div class="alert-dialog">
        <div class="alert-dialog-container">
            <div class="alert-dialog-title">
                Hi Geek
            </div>
            <div class="alert-dialog-content">
                This is an alert.
            </div>
            <div class="alert-dialog-footer">
                <button class="alert-dialog-button">OK
                  </button>
                <button class="alert-dialog-button">CANCEL
                  </button>
            </div>
        </div>
    </div>
</body>
</html>

Output:

 

Example 2: The below example demonstrates how you can add other CSS components to an alert dialog.




<!DOCTYPE html>
<html>
  
<head>
    <link rel="stylesheet" href=
    <link rel="stylesheet" href=
</head>
  
<body>
    <div style="margin:3rem;font-family:Roboto,sans-serif;">
        <h1 style="color:green;">
            GeeksforGeeks
          </h1>
        <h3 style="margin-top:-1.5rem;">
            Onsen UI Dialog CSS Component Material Alert Dialog
          </h3>
    </div>
    <div class="alert-dialog-mask">
      </div>
    <div class="alert-dialog">
        <div class="alert-dialog-container">
            <div class="alert-dialog-title">
                Hi Geek
            </div>
            <div class="alert-dialog-content">
                You want to study from GFG?
            </div>
            <div class="alert-dialog-footer">
                <label class="switch switch--material" 
                       style="float:right; 
                              margin-right:2rem; 
                              margin-bottom:1rem;">
                    <input type="checkbox"
                           class="switch__input switch--material__input">
                    <div class="switch__toggle switch--material__toggle">
                        <div class="switch__handle switch--material__handle">
                        </div>
                    </div>
                </label>
            </div>
        </div>
    </div>
</body>
</html>

Output:

 

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


Article Tags :