Open In App

Blaze UI Toggles

Blaze UI is a CSS open-source framework. It is a lightweight UI toolkit and provides great tools for building customized and scalable applications. It can work with any framework that exists. It can adapt to any ecosystem. All designs or CSS are mobile-first and hence responsive. It project is available open-source so a large community maintains it.

Blaze UI Toggles can be used to check or uncheck, based on the condition, by toggling the button, which is styled with attractive and beautiful toggle buttons. Besides that, the toggles have many attributes and methods to control them programmatically. The toggles have different colors according to the use case.



Blaze UI Toggles Attributes:

Blaze UI Toggles Method:



Blaze UI Toggle Color Types:

Syntax: To create a Blaze UI toggle, use the following syntax:

<blaze-toggle toggled type="colorType">Content</blaze-toggle>

Example 1: This example illustrates the Blaze UI Toggles having different colors of toggles.




<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" 
          content="width=device-width, 
                   initial-scale=1.0" />
    <title>GeeksforGeeks BlazeUI</title>
    <link rel="stylesheet" href=
    <script type="module" src=
    </script>
    <script nomodule="" src=
    </script>
</head>
  
<body>
    <div class="o-container">
        <center>
            <div>
                <h1 style="color: green;">GeeksforGeeks</h1>
                <h3>Blaze UI Toggles</h3>
            </div>
            <div class="u-center-block__content 
                u-center-block__content--horizontal">
                <blaze-toggle toggled type="error">
                    Error Toggle
                </blaze-toggle>
                <blaze-toggle toggled type="info">
                    Info Toggle
                </blaze-toggle>
                <blaze-toggle toggled>
                    Default Toggle
                </blaze-toggle>
                <blaze-toggle toggled type="warning">
                    Warning Toggle
                </blaze-toggle>
                <blaze-toggle toggled type="success">
                    Success Toggle
                </blaze-toggle>
                <blaze-toggle toggled type="brand">
                    Brand Toggle
                </blaze-toggle>
            </div>
        </center>
    </div>
</body>
</html>

Output:

 

Example 2: In the following example, when we click on the button, we get an alert that the toggle on the page is toggled or not.




<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" 
          content="width=device-width,
                   initial-scale=1.0" />
    <title>GeeksforGeeks BlazeUI</title>
    <link rel="stylesheet" href=
    <script type="module" src=
    </script>
    <script nomodule="" src=
    </script>
</head>
  
<body>
    <div class="o-container">
        <center>
            <div>
                <h2 style="color: green;">GeeksforGeeks</h2
                <h4>Blaze UI Toggles</h4>
            </div>
            <blaze-toggle toggled type="success" 
                          id="toggle">
                GeeksforGeeks is the Best Website for
                Computer Science 
            </blaze-toggle>
            <button onclick="checkAnswer()">Check Answer</button>
        </center>
    </div>
    <script>
        async function checkAnswer() {
            let toggled = 
            await document.getElementById('toggle').isToggled()
            alert('The answer is ' + toggled)
        }
    </script>
</body>
</html>

Output:

 

Reference: https://www.blazeui.com/components/toggles


Article Tags :