VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-list-group-methods/

⇱ Bootstrap 5 List group Methods - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 List group Methods

Last Updated : 27 Jul, 2025

Bootstrap 5 List Group methods that are used to control the visibility of the List Group component. For example, these methods can be used to show a list of group components or dispose of them.

Bootstrap 5 List Group Methods:

  • constructor: It is used to activate a tab element as a Bootstrap 5 List Group element after which we can utilize different methods given by Bootstrap 5 such as show(), dispose(), etc.
  • show: It is used to activate and select a tab and show the content relevant to it.
  • dispose: It is used to destroy the element as a Bootstrap 5 list group element.
  • getInstance: It is a static method that is used to get the list group element associated with the DOM.
  • getOrCreateInstance: It is a static method that is used to get the list group element associated with the DOM or create a new one if it is not present.

Syntax:

listGroupElement.list_group_method()

Example 1: In this example, we will show different List group tabs using the "show()" method given by the Bootstrap 5 List Group object.

Output

Example 2: In this example, we will show and dispose of the list group element using the "show()" and "dispose()" methods given by the Bootstrap 5 List Group object. Once we dispose of a list group element, we cannot use any methods given by the Bootstrap 5 List Group object as it gets destroyed in the DOM. 


Output:

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

Comment

Explore