Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • BS5 Tutorial
  • BS5 Interview Questions
  • BS5 Layout
  • BS5 Content
  • BS5 Components
  • BS5 Helpers
  • BS5 Utilities
  • BS4 Tutorial
  • BS Tutorial
  • Bootstrap Cheatsheet
  • Tailwind
  • CSS Frameworks
  • HTML Formatter
Open In App
Next Article:
Bootstrap 5 List group Using data Attributes
Next article icon

Bootstrap 5 List group JavaScript behavior

Last Updated : 26 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Bootstrap5 list group JavaScript behavior is used to generate tabbable panes of local material by expanding our list group.

Bootstrap 5  List group JavaScript behavior:

  • Using data attributes: We can enable the List group by using data attributes without using any javascript code. We need to pass data-bs-toggle = "list" on the element and .list-group-item on the list of elements.
  • Via JavaScript: We can also activate the bootstrap lit group via javascript.
  • Fade effect: We can add a .fade  class to each .tab-pane to have the tabs panel fade in. For the original content to be displayed, the first tab pane also has to have a .show. 
  • Methods: Methods are used to undertake different specific actions on the list group, We have some methods like constructor, show, dispose of, getInstance, and getOrCreateInstance.
  • Events: Events are used to perform some of the basic functionalities. Some of the events are automatically triggered when we call the corresponding method.

Example 1: In these, we will demonstrate the bootstrap 5 list group.

HTML
<!DOCTYPE html> <html>  <head>     <meta charset="utf-8">     <meta name="viewport"            content="width=device-width, initial-scale=1">     <title></title>     <!-- Bootstrap CSS -->     <link rel="stylesheet" href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">     <!-- Bootstrap JavaScript -->     <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js">       </script> </head>  <body>     <h1 class="text-success">GeeksforGeeks</h1>     <div class="list-group">         <button type="button"                  class="list-group-item list-group-item-action active">             Item 1         </button>         <button type="button"                  class="list-group-item list-group-item-action">             Item 2         </button>         <button type="button"                  class="list-group-item list-group-item-action">             A third button item         </button>         <button type="button"                  class="list-group-item list-group-item-action"                  disabled>             A disabled item         </button>     </div> </body>  </html> 

Output:

Example 2: In this example, we will demonstrate bootstrap 5 list group fade effects.

HTML
<!DOCTYPE html> <html>  <head>     <meta charset="utf-8">     <meta name="viewport"            content="width=device-width, initial-scale=1">     <title></title>     <!-- Bootstrap CSS -->     <link rel="stylesheet" href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">     <!-- Bootstrap JavaScript -->     <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> </head>  <body>     <h1 class="text-success">GeeksforGeeks</h1>     <div class="row">         <div class="col-2">             <div class="list-group">                 <a class="list-group-item "                     data-bs-toggle="list" href="#java">                     JAVA                 </a>                 <a class="list-group-item"                     data-bs-toggle="list" href="#python">                     PYTHON                 </a>                 <a class="list-group-item"                     data-bs-toggle="list" href="#c">                     C++                 </a>             </div>         </div>         <div class="col text-white">             <div class="">                 <div class=" fade bg-info rounded " id="java">                     <h3 class="text-dark">JAVA</h3>                     <p>Java is a high-level, class-based, object-oriented</p>                     <p>programming language that is designed to have as few</p>                     <p> implementation dependencies as possible.</p>                 </div>                 <div class="fade bg-secondary rounded" id="python">                     <h3 class="text-dark">PYTHON</h3>                     <p>Python is a high-level, general-purpose programming </p>                     <p> language. Its design philosophy emphasizes code </p>                     <p> readability with the use of significant indentation.</p>                 </div>                 <div class="fade bg-primary rounded" id="c">                     <h3 class="text-dark">C++</h3>                     <p>C++ is a cross-platform language that can be used </p>                     <p>to create high-performance applications. C++ was</p>                     <p>developed by Bjarne Stroustrup, as an extension to the C</p>                 </div>             </div>         </div>     </div> </body>  </html> 

Output:

Reference: https://getbootstrap.com/docs/5.0/components/list-group/#javascript-behavior


Next Article
Bootstrap 5 List group Using data Attributes

S

sukanya825
Improve
Article Tags :
  • Technical Scripter
  • Web Technologies
  • Bootstrap
  • Technical Scripter 2022
  • 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
    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
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences