THE WORLD'S LARGEST WEB DEVELOPER SITE

Bootstrap 4 List Groups


Basic List Groups

The most basic list group is an unordered list with list items:

  • First item
  • Second item
  • Third item

To create a basic list group, use an <ul> element with class .list-group, and <li> elements with class .list-group-item:

Example

<ul class="list-group">
  <li class="list-group-item">First item</li>
  <li class="list-group-item">Second item</li>
  <li class="list-group-item">Third item</li>
</ul>
Try it Yourself »

Active State

  • Active item
  • Second item
  • Third item

Use the .active class to highlight the current item:

Example

<ul class="list-group">
  <li class="list-group-item active">Active item</li>
  <li class="list-group-item">Second item</li>
  <li class="list-group-item">Third item</li>
</ul>
Try it Yourself »

Disabled Item

  • Disabled item
  • Second item
  • Third item

To disable an item, add the .disabled class:

Example

<ul class="list-group">
  <li class="list-group-item disabled">Disabled item</li>
  <li class="list-group-item">Second item</li>
  <li class="list-group-item">Third item</li>
</ul>
Try it Yourself »

List Group With Linked Items

To create a list group with linked items, use <div> instead of <ul> and <a> instead of <li>. Also add the .list-group-item-action class if you want a grey background color on hover:

Example

<div class="list-group">
  <a href="#" class="list-group-item list-group-item-action">First item</a>
  <a href="#" class="list-group-item list-group-item-action">Second item</a>
  <a href="#" class="list-group-item list-group-item-action">Third item</a>
</div>
Try it Yourself »

Contextual Classes

Contextual classes can be used to color list items:

  • Success item
  • Secondary item
  • Info item
  • Warning item
  • Danger item
  • Primary item
  • Dark item
  • Light item

The classes for coloring list-items are: .list-group-item-success, list-group-item-secondary, list-group-item-info, list-group-item-warning, .list-group-item-danger, list-group-item-dark and list-group-item-light,:

Example

<ul class="list-group">
  <li class="list-group-item list-group-item-success">Success item</li>
  <li class="list-group-item list-group-item-secondary">Secondary item</li>
  <li class="list-group-item list-group-item-info">Info item</li>
  <li class="list-group-item list-group-item-warning">Warning item</li>
  <li class="list-group-item list-group-item-danger">Danger item</li>
  <li class="list-group-item list-group-item-primary">Primary item</li>
  <li class="list-group-item list-group-item-dark">Dark item</li>
  <li class="list-group-item list-group-item-light">Light item</li>
</ul>
Try it Yourself »

Link items with Contextual Classes

Example

<div class="list-group">
  <a href="#" class="list-group-item list-group-item-action">Action item</a>
  <a href="#" class="list-group-item list-group-item-success">Success item</a>
  <a href="#" class="list-group-item list-group-item-secondary">Secondary item</a>
  <a href="#" class="list-group-item list-group-item-info">Info item</a>
  <a href="#" class="list-group-item list-group-item-warning">Warning item</a>
  <a href="#" class="list-group-item list-group-item-danger">Danger item</a>
  <a href="#" class="list-group-item list-group-item-primary">Primary item</a>
  <a href="#" class="list-group-item list-group-item-dark">Dark item</a>
  <a href="#" class="list-group-item list-group-item-light">Light item</a>
</div>
Try it Yourself »