List group is a effective and useful component that is found in Bootstrap 4. The element is taken for featuring a string or 'list' information. The list group items can be altered and expanded to provide almost any sort of web content within just together with a couple of options readily available for modification in the list in itself. Such list groups can possibly also be operated for site navigation along with making use of the proper modifier class.
In Bootstrap 4, the Bootstrap List Style is a segment which forms the unordered lists in a certain approach considering it paves the way for generating custom-made content just within structure lists without needing to concerned about the presentation concern ( due to the fact that the language takes care of that by itself).
Delivered here are the specialities which are readily available inside the list group element with Bootstrap 4:
• Unordered list: The absolute most standard form of list group that you can easily develop in Bootstrap 4 is an unordered list that has a number of things with the appropriate classes. You are able to built upon it by the various solutions which are provided in the element.
• Active items: You can certainly focus on the existing active selection via just incorporating the .active
direction to a .list-group-item
. This is effective for if you want to build a list of materials that is clickable.
• Disabled materials: You can easily even de-highlight a list stuff making it show up as though it has been actually disabled. You just simply need to add in the .disabled
extension to the .list-group-item
for doing this.
• Links and Buttons: With help from the buttons tag, you may quite easily make an actionable element in the Bootstrap List Group what means that you will definitely have the ability to bring in hover, active, and disabled states to these types of items with making use of the .list-group-item-action
opportunity. { You can disconnect these types of pseudo-classes from the remaining classes in order to assure that the non-interactive components in your code such as <div>
-s or <lis>
s are workable or not clickable as well. It is suggested that you do not really employ the standard button classes i.e .btn
here.
• Contextual classes: This is an additional clever feature that is part of the list group component that enables you to design each and every list element along with a specific color and background. These are especially handy for emphasize some materials or categorizing them according to color-'s code.
• • Badges: You have the ability to additionally add badges to a list material to present the unread counts, activity on the item, and make it easy for some other active elements through the use of additional utilities.
One of the most essential list group is an unordered list plus list pieces and the appropriate classes. Build upon it with the selections that follow, or even having your own CSS as desired.
<ul class="list-group">
<li class="list-group-item">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
Put in a .active
to a .list-group-item
to reveal the accepted active option.
<ul class="list-group">
<li class="list-group-item active">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
Add in .disabled
to a .list-group-item
to make it show up disabled. Note that various features with will definitely also require custom made JavaScript to entirely eliminate their click on occasions (e.g., links).
<ul class="list-group">
<li class="list-group-item disabled">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
Work with <a>
-s or <button>
-s to develop workable list group things with hover, disabled, and active forms via including .list-group-item-action
. We split up these pseudo-classes to make sure list groups made of non-interactive components (like <li>
-s as well as <div>
-s) don't provide a click on as well as touching affordance.
Ensure to not employ the basic .btn
classes here.
<div class="list-group">
<a href="#" class="list-group-item active">
Cras justo odio
</a>
<a href="#" class="list-group-item list-group-item-action">Dapibus ac facilisis in</a>
<a href="#" class="list-group-item list-group-item-action">Morbi leo risus</a>
<a href="#" class="list-group-item list-group-item-action">Porta ac consectetur ac</a>
<a href="#" class="list-group-item list-group-item-action disabled">Vestibulum at eros</a>
</div>
Through <button>
-s, you can easily also work with the disabled
attribute as opposed to .disabled
the class. Sadly, <a>
-s don't support the disabled attribute.
<div class="list-group">
<button type="button" class="list-group-item list-group-item-action active">
Cras justo odio
</button>
<button type="button" class="list-group-item list-group-item-action">Dapibus ac facilisis in</button>
<button type="button" class="list-group-item list-group-item-action">Morbi leo risus</button>
<button type="button" class="list-group-item list-group-item-action">Porta ac consectetur ac</button>
<button type="button" class="list-group-item list-group-item-action" disabled>Vestibulum at eros</button>
</div>
Use contextual classes to form list elements using a stateful background and colour.
<ul class="list-group">
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item list-group-item-success">Dapibus ac facilisis in</li>
<li class="list-group-item list-group-item-info">Cras sit amet nibh libero</li>
<li class="list-group-item list-group-item-warning">Porta ac consectetur ac</li>
<li class="list-group-item list-group-item-danger">Vestibulum at eros</li>
</ul>
Contextual classes as well do the job with .list-group-item-action
. Keep in mind the attachment of the hover styles here not present in the earlier example. In addition supported is the .active
; apply it to signify an active selection on a contextual list group thing.
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action">Dapibus ac facilisis in</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-success">Dapibus ac facilisis in</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-info">Cras sit amet nibh libero</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-warning">Porta ac consectetur ac</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-danger">Vestibulum at eros</a>
</div>
Employing different colors to include signifying just provides a visional indication, which will not be communicated to operators of assistive systems -- such as screen readers. Be sure that relevant information shown by the color option is either evident from the content itself (e.g. the visible content), or else is featured through different solutions, for example, additional text hidden with the .sr-only
class.
Include badges to any sort of list group piece to present unread counts, activity, and even more with the help of certain utilities. Note the justify-content-between utility class and the badge's placement.
<ul class="list-group">
<li class="list-group-item justify-content-between">
Cras justo odio
<span class="badge badge-default badge-pill">14</span>
</li>
<li class="list-group-item justify-content-between">
Dapibus ac facilisis in
<span class="badge badge-default badge-pill">2</span>
</li>
<li class="list-group-item justify-content-between">
Morbi leo risus
<span class="badge badge-default badge-pill">1</span>
</li>
</ul>
Put in pretty much any HTML within, and even for related list groups like the one listed below, with help from flexbox utilities.
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start active">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">List group item heading</h5>
<small>3 days ago</small>
</div>
<p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
<small>Donec id elit non mi porta.</small>
</a>
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">List group item heading</h5>
<small class="text-muted">3 days ago</small>
</div>
<p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
<small class="text-muted">Donec id elit non mi porta.</small>
</a>
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">List group item heading</h5>
<small class="text-muted">3 days ago</small>
</div>
<p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
<small class="text-muted">Donec id elit non mi porta.</small>
</a>
</div>
Overall, list group is a robust and helpful element in Bootstrap 4 which helps you to create an unordered list a lot more organized, interactive, and responsive with no ruining on the look or layout of the list objects themselves.
Bootstrap list training
Bootstrap list trouble