Semantic-UI Button Toggle Variations Last Updated : 07 Mar, 2022 Comments Improve Suggest changes Like Article Like Report Semantic UI is an open-source framework that uses CSS and jQuery to build great user interfaces. It is the same as a Bootstrap for use and has great different elements to use to make your website look more amazing. Semantic UI has a bunch of components for user interface design. One of them is “Buttons”. Buttons are used to enable users to perform different actions through a click action. Users can click as per their choice. There are different Variations of Buttons based on their shape and style. One of them is the toggle Variation Semantic UI Button Toggle Variation is used to make the Button in the form of a toggle that can be used by the user to select a true or false value. It adds a different look than the default Button. Semantic-UI Button Toggle Variation Class: toggle: This class is used to display the Button in the form of a toggle. Syntax: <button class="ui toggle button">.....</button> These examples demonstrate the button toggle variation using the toggle class. Example 1: HTML <!DOCTYPE html> <html> <head> <link rel="stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" /> <script src= "https://code.jquery.com/jquery-3.1.1.min.js"> </script> <script src= "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js"> </script> </head> <body> <br /><br /> <div class="ui container"> <h2 style="color:green"> GeeksforGeeks </h2> <b> <p>Semantic UI Button Toggle Variation</p> </b> <hr> <br /> <strong>Toggle button: </strong> <br /><br /> <button class="ui toggle button" id="suscribe"> Toggle OFF </button> <script> $('#suscribe').click(function () { $(this).toggleClass('active'); if($(this).hasClass('active')){ $(this).text("Toggle ON"); } else { $(this).text("Toggle OFF"); } }); </script> </div> </body> </html> Output : Semantic-UI Button Toggle Variations Example 2: HTML <!DOCTYPE html> <html> <head> <title>Semantic-UI Button Toggle Variations</title> <link rel="stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" /> <script src= "https://code.jquery.com/jquery-3.1.1.min.js"> </script> <script src= "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js"> </script> </head> <body> <br /><br /> <div class="ui container"> <h2 style="color:green"> GeeksforGeeks </h2> <b> <p>Semantic UI Button Toggle Variation</p> </b> <hr> <br /> <strong>Toggle Button:</strong> <br /><br /> <button class="ui toggle button" id="suscribe"> Subscribed to GFG weekly newsletters </button> <script> $('#suscribe').click(function () { $(this).toggleClass('active'); if($(this).hasClass('active')){ $(this).text("Subscribed to GFG weekly newsletters"); } else { $(this).text("Subscribe to GFG weekly newsletters"); } }); </script> </div> </body> </html> Output: Semantic-UI Button Toggle Variations Reference: https://semantic-ui.com/elements/button.html#toggle Comment More infoAdvertise with us Next Article Semantic-UI Button Toggle Variations N namankedia Follow Improve Article Tags : Web Technologies CSS Geeks Premier League Geeks-Premier-League-2022 Semantic-UI Semantic-UI Elements +1 More Similar Reads Semantic-UI Button Variations Semantic UI is a modern framework used in developing seamless designs for the website, It gives the user a lightweight experience with its components. It uses the predefined CSS and jQuery to incorporate in different frameworks. Semantic UI Button Group offers variation of button, there are Social b 4 min read Semantic-UI Button Size Variations Semantic UI is a modern framework used in developing seamless designs for the website, It gives the user a lightweight experience with its components. It uses predefined CSS and jQuery to incorporate different frameworks. Semantic-UI Button Variations offers us so many variations in buttons like soc 2 min read Semantic-UI Button Group Variations Semantic UI is a modern framework used in developing seamless designs for the website, It gives the user a lightweight experience with its components. It uses predefined CSS and jQuery to incorporate different frameworks. Semantic UI Button Group also offers a group variation of buttons, there are I 3 min read Semantic-UI Button Fluid Variations Semantic UI is an open-source framework that uses CSS and jQuery to build great user interfaces. It is the same as a bootstrap for use and has great different elements to use to make your website look more amazing. Semantic UI Button offers several types of micro button components like Types, Groups 2 min read Semantic-UI Button Variations Social Variant Semantic UI offers many components for users to design their interface. The Semantic UI Button Variations offers us many variations in buttons like social, size, floated, colored, compact, toggle, positive, negative, fluid, circular, vertical and horizontal attached buttons. Here in this article, we 2 min read Like