Bootstrap 5 List Group

List groups in Bootstrap 5 provide a flexible and customizable way to display a series of content, such as navigation links or informational items

Basic Example:

The <ul> element with the .list-group class. Then add the .list-group-item to each <li> element and a .list-group-link class to each link inside <li>

  • Item 1
  • Item 2
  • Item 3
Example
<ul class="list-group">
<li class="list-group-item">Item 1</li>
<li class="list-group-item">Item 2</li>
<li class="list-group-item">Item 3</li>
</ul>

Try it yourself

Active and Disabled Items:

Use .active to highlight an item and .disabled to disable it.

  • Active Item
  • Item 2
  • Disabled Item
Example
<ul class="list-group">
<li class="list-group-item active" aria-current="true">Active Item</li>
<li class="list-group-item">Item 2</li>
<li class="list-group-item disabled" aria-disabled="true">Disabled Item</li>
</ul>

Try it yourself

List Group with Links

Use a elements for clickable list items.

Example
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action active" aria-current="true">
Active Link
</a>
<a href="#" class="list-group-item list-group-item-action">Link 2</a>
<a href="#" class="list-group-item list-group-item-action disabled" tabindex="-1" aria-disabled="true">
Disabled Link
</a>
</div>

Try it yourself

Flush / Remove Borders

Use .list-group-flush for a list group with no borders and a seamless look.

  • Item 1
  • Item 2
  • Item 3
Example
<ul class="list-group list-group-flush">
<li class="list-group-item">Item 1</li>
<li class="list-group-item">Item 2</li>
<li class="list-group-item">Item 3</li>
</ul>

Try it yourself

Numbered List Groups

Use .list-group-numbered elements for numbered list items.

  1. First item
  2. Second item
  3. Third item
Example
<ol class="list-group list-group-numbered">
<li class="list-group-item">First item</li>
<li class="list-group-item">Second item</li>
<li class="list-group-item">Third item</li>
</ol>

Try it yourself

List Group with Links

Use .list-group-horizontal to align items horizontally. Combine with responsive breakpoints for different layouts.

  • Item 1
  • Item 2
  • Item 3

Responsive
  • Item 1
  • Item 2
  • Item 3
Example
<ul class="list-group list-group-horizontal">
<li class="list-group-item">Item 1</li>
<li class="list-group-item">Item 2</li>
<li class="list-group-item">Item 3</li>
</ul>
<br/>
<h5>Responsive</h5>
<ul class="list-group list-group-horizontal-md">
<li class="list-group-item">Item 1</li>
<li class="list-group-item">Item 2</li>
<li class="list-group-item">Item 3</li>
</ul>

Try it yourself

Contextual Classes

Add colors using contextual classes like .list-group-item-primary.list-group-item-secondary, etc.

  • Primary Item
  • Success Item
  • Danger Item
Example
<ul class="list-group">
<li class="list-group-item list-group-item-primary">Primary Item</li>
<li class="list-group-item list-group-item-success">Success Item</li>
<li class="list-group-item list-group-item-danger">Danger Item</li>
</ul>

Try it yourself


Whereisstuff is simple learing platform for beginer to advance level to improve there skills in technologies.we will provide all material free of cost.you can write a code in runkit workspace and we provide some extrac features also, you agree to have read and accepted our terms of use, cookie and privacy policy.
© Copyright 2024 www.whereisstuff.com. All rights reserved. Developed by whereisstuff Tech.