Bootstrap 5 List group Using data Attributes Last Updated : 15 Dec, 2022 Comments Improve Suggest changes Like Article Like Report Bootstrap 5 List group Using data attributes allows you to add your own information to tags. The data-* attributes can be used to define our own custom data attributes. It is used to store custom data in private on the page or application. In the List group, using data attributes is the sub-topic of JavaScript behavior, so by using data attributes in the list group you can activate a list group navigation without writing any JavaScript by simply specifying data-bs-toggle=" list" or on an element. Use these data attributes on .list-group-item. Bootstrap 5 List group Using data attributes Class: There is no pre-defined class for this data-bs-toggle attribute plays the main role. Bootstrap 5 List group Using data attributes: data-bs-toggle: This attribute is used to make the list group active, the value of this attribute is list. Syntax: <div class="list-group"> <a class="list-group-item" data-bs-toggle="list" href="#">...</a> ... </div> Below examples illustrate the Bootstrap 5 List group Using data attributes: Example 1: The following example demonstrates the use of a List group Using data attributes in Bootstrap 5. HTML <!DOCTYPE html> <html> <head> <!-- Bootstrap CDN --> <link rel="stylesheet" href= "https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css" integrity= "sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I" crossorigin="anonymous"> <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity= "sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"> </script> <script src= "https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js" integrity= "sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/" crossorigin="anonymous"> </script> <style> body{ margin-left:10px; margin-right:10px; } </style> </head> <body> <center> <h2 class="text-success">GeeksforGeeks</h2> <h3><b>Learning list group data attributes</b></h3> <div role="tabpanel"> <!-- List group --> <div class="list-group" id="myList" role="tablist"> <a class= "list-group-item list-group-item-action active text-danger" data-bs-toggle="list" href="#html" role="tab"> <b>HTML</b> </a> <a class= "list-group-item list-group-item-action bg-orange text-primary" data-bs-toggle="list" href="#javascript" role="tab"> <b>JAVASCRIPT</b> </a> <a class= "list-group-item list-group-item-action bg-warning text-success" data-bs-toggle="list" href="#CSS" role="tab"> <b>CSS</b> </a> <a class= "list-group-item list-group-item-action bg-dark text-danger" data-bs-toggle="list" href="#Python" role="tab"> <b>PYTHON</b> </a> </div> </div> </center> </body> </html> Output: Bootstrap 5 List group Using data attributes Example 2: The following examples demonstrate the use of a List group Using data attributes in Bootstrap 5. HTML <!DOCTYPE html> <html> <head> <!-- Load Bootstrap --> <link rel="stylesheet" href= "https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css" integrity= "sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I" crossorigin="anonymous"> <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity= "sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"> </script> <script src= "https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js" integrity= "sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/" crossorigin="anonymous"> </script> </head> <body class="mx-4"> <h2 class="text-success">GeeksforGeeks</h2> <h3>Learning List group using data attributes</h3> <div class="tab-content"> <ul> <li> <div class="menu-panel text-warning" id="python"> <b>Python</b> </div> </li> <li> <div class="menu-panel text-primary" id="java"> <b>JAVA</b> </div> </li> <li> <div class="menu-panel text-secondary" id="javascript"> <b>Javascript</b> </div> </li> <li> <div class="menu-panel text-info" id="PHP" > <b>PHP</b> </div> </li> </ul> </div> </body> </html> Output: Bootstrap 5 List group Using data attributes Reference: https://getbootstrap.com/docs/5.2/components/list-group/#using-data-attributes Comment More infoAdvertise with us K kumarbalit8 Follow Improve Article Tags : Web Technologies Bootstrap Bootstrap-5 Similar Reads Bootstrap 5 List group Active items Bootstrap 5 provides the List Group Active feature in which items are stored in form of a list. List groups are a flexible and powerful component for displaying a series of content. The List Group Active feature is used to indicate the currently active selection. List group Active items classes: .ac 2 min read Bootstrap 5 List group Disabled items Bootstrap 5 provides the List Group disabled items feature in which items are stored in form of a list. List groups are a flexible and powerful component for displaying a series of content. The List Group Disabled items feature is used to indicate the item is currently disabled. List Group Disabled 2 min read Bootstrap 5 List group Links and buttons Bootstrap 5 provides the List Group Links and Buttons items feature in which items are actionable and stored in form of a list. List groups are a flexible and powerful component for displaying a series of content. The List Group Links and Buttons items feature is used to indicate the item is current 2 min read Bootstrap 5 List group Flush Bootstrap 5 provides the List Group Flush feature in which items are stored in the form of a list. List groups are a flexible and powerful component for displaying a series of content. The List Group Flush feature is used to remove borders and rounded corners around the items on the list. List group 2 min read Bootstrap 5 List group Numbered Bootstrap 5 List Group Numbered is one of the capabilities offered by List Group in Bootstrap 5, which is used to keep items in the form of a list and display them sequentially through the use of numbers. List Group Numbered Classes: list-group-item: This class is used to indicate and add the items 2 min read Bootstrap 5 List group Horizontal Bootstrap 5 List group Horizontal facilitates to modification & alignment of the structure of the list group items from vertical to horizontal, across all breakpoints, by implementing the .list-group-horizontal class. In order to create a list group horizontal that starts with the min-width of t 2 min read Bootstrap 5 List group Contextual classes Bootstrap 5 List group Contextual classes are used to style list-group-items with different backgrounds and colors. Bootstrap 5 List group Contextual Used Classes: list-group-item-primary: For blue color styling of the list itemlist-group-item-success: For green color styling of the list itemlist-gr 2 min read Bootstrap 5 List group with badges Bootstrap 5 List group with badges can be used to add badges to the list group item to indicate the count of objects. List group With badges Classes: No special classes are used in the List group With badges. You can customize the list using .badge classes and style them with flex. Bootstrap 5 List 2 min read Bootstrap 5 List group Custom content Bootstrap 5 List Group Custom content allows us to use HTML inside the list, here, the term "Custom Content" refers to HTML, therefore any HTML elements can be used inside, including anchor tags, paragraph tags, divs, photos, and many more.Bootstrap 5 List Group Custom content Classes: There is no p 2 min read Bootstrap 5 List group Checkboxes and radios Bootstrap 5 List group Checkboxes and radios use .list-group and .list-group-item classes to create a list of items. The .list-group class is used with <ul> element and the .list-group-item is used with <li> element. Then create the checkbox and radios in the input element using the type 2 min read Like