List group is a effective and versatile component which is looked up in Bootstrap 4. The element is employed for displaying a set or 'list' web content. The list group elements can be transformed and enhanced to promote almost any type of material within just with a number of opportunities provided for modification inside of the list in itself. These types of list groups can certainly also be applied for navigation along with making use of the correct modifier class.
In Bootstrap 4, the Bootstrap List Example is a element that designs the unordered lists in a certain approach since it paves the way for making customized content inside complex lists without having to think about the demonstration trouble ( due to the fact that the language looks after that on its own).
Delivered lower are the properties which are attainable just within the list group component within Bootstrap 4:
• Unordered list: The absolute most simple type of list group which you can easily set up in Bootstrap 4 is an unordered list that has a variety of things using the appropriate classes. You can easily built upon it by the additional alternatives that are offered in the component.
• Active elements: You have the ability to pointed out the existing active option with just incorporating the .active
order to a .list-group-item
. This is useful for whenever you would like to make a list of pieces that is able for clicking.
• Disabled materials: You have the ability to additionally de-highlight a list piece to get it show up as despite the fact that it has been disabled. You just simply have to include the .disabled
extension to the .list-group-item
for doing so.
• Hyperlinks and Buttons: With help from the buttons tag, you are able to simply produce an actionable thing in the Bootstrap List Group which means that you will definitely have the ability to bring in hover, active, and disabled states to these objects via making use of the .list-group-item-action
possibility. { You have the ability to disconnect these kinds of pseudo-classes from the remaining classes to guarantee that the non-interactive elements in your code like <div>
-s or <lis>
s are actionable or not clickable as well. It is suggested that you do not really apply the standard button classes i.e .btn
here.
• Contextual classes: This is yet another cool element that becomes part of the list group element which helps you to style each list item using a specific color and background. These are particularly useful for emphasize special items as well as categorizing them according to color-'s code.
• • Badges: You have the ability to in addition bring in badges to a list object to show the unread counts, activity on the object, and enable additional involved functions via installing additional services.
Probably the most fundamental list group is an unordered list with list elements and the appropriate classes. Build upon it through the solutions that follow, or else utilizing 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>
Add to a .active
to a .list-group-item
to display the present active variety.
<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 seem like disabled. Take note that a number of elements with are going to additionally need custom-made JavaScript to entirely turn off their select occasions (e.g., urls).
<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>
Employ <a>
-s or else <button>
-s to create actionable list group items having hover, disabled, and active states via incorporating .list-group-item-action
. We separate these pseudo-classes to make certain list groups constructed from non-interactive components (like <li>
-s as well as <div>
-s) don't produce a select or touching affordance.
Be sure to not apply the common .btn
classes in this case.
<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 surely as well use the disabled
attribute as an alternative to .disabled
the class. Sadly, <a>
-s don't support the disabled feature.
<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 design list items using a stateful background along with color.
<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 in addition do the job with .list-group-item-action
. Consider the attachment of the hover styles here not present in the last situation. At the same time supported is the .active
; employ it to signify an active selection on a contextual list group unit.
<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>
Putting into action color option to provide indicating just presents a graphical indication, which in turn will not be revealed to operators of assistive modern technologies -- for example, screen readers. Ensure that data shown with the colour is either evident directly from the content itself (e.g. the exposed text), or else is incorporated with alternate means, like additional text hidden with the .sr-only
class.
Put in badges to any sort of list group object to present unread counts, activity, and more through a number of utilities. Take note of the justify-content-between utility class and the badge's position.
<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>
Incorporate nearly any kind of HTML within, even for connectioned list groups like the one below, with the aid of 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>
In conclusion, list group is a robust and helpful component within Bootstrap 4 that helps you to produce an unordered list a lot more coordinated, interactive, and responsive without any giving in on the visual appeal or layout of the list pieces themselves.
Bootstrap list guide
Bootstrap list issue