Bootstrap List Group

Bootstrap list group is used to design the html lists. To create a basic list group you have to use an <ul> element with .list-group class and <li> elements with .list-group-item class.

Example:

<ul class="list-group">
<li class="list-group-item"> 1st list </li>
<li class="list-group-item"> 2nd list </li>
<li class="list-group-item"> 3rd list </li>
</ul>

Run Example

Add Badges

If you want to add a badge to the list group you should use the <span class = "badge"> within the <li> element.

Example:

<ul class="list-group">
<li class="list-group-item"> 1st list <span class="badge"> 1 </span> </li>
<li class="list-group-item"> 2nd list <span class="badge"> 2 </span> </li>
<li class="list-group-item"> 3rd list <span class="badge"> 3 </span> </li>
</ul>

Run Example

Linking Item with List Group

If you want to link the list group item you should use <div> instead of <ul> and <a> instead of <li>.

Example:

<div class="list-group">
<a href="#" class="list-group-item"> 1st list </a>
<a href="#" class="list-group-item"> 2nd list </a>
<a href="#" class="list-group-item"> 3rd list </a>
</div>

Run Example

Active and Disabled State

To highlight the current item you can add the .active class and to disable an item you can add the .disabled class:

Example of active class:

<div class="list-group">
<a href="#" class="list-group-item active"> 1st list </a>
<a href="#" class="list-group-item"> 2nd list </a>
<a href="#" class="list-group-item"> 3rd list </a>
</div>

Run Example

Example of disable class:

<div class="list-group">
<a href="#" class="list-group-item disabled"> 1st list </a>
<a href="#" class="list-group-item"> 2nd list </a>
<a href="#" class="list-group-item"> 3rd list </a>
</div>

Run Example

Contextual Class with List Group

If you want to colour the list group item you should use .list-group-item-success, .list-group-item-info, .list-group-item-warning, and .list-group-item-danger classes.

Example:

<div class="list-group">
<a class="list-group-item list-group-item-success"> 1st list </a>
<a class="list-group-item list-group-item-info"> 2nd list </a>
<a class="list-group-item list-group-item-warning"> 3rd list </a>
<a class="list-group-item list-group-item-danger"> 4th list </a>
</div>

Run Example