List group is a effective and flexible component that is found in Bootstrap 4. The element is operated for showing a series or 'list' content. The list group items can be altered and increased to promote nearly any kind of web content just within through a variety of features readily available for customization inside of the list itself. These kinds of list groups can possibly additionally be employed for navigation together with making use of the correct modifier class.
In Bootstrap 4, the Bootstrap List Css is a segment that designs the unordered lists in a specific method as it paves the way for developing customized information within complex lists without needing to think about the demonstration concern (since the language deals with that by itself).
Delivered lower are the properties that are accessible just within the list group element in Bootstrap 4:
• Unordered list: The absolute most essential type of list group which you can develop in Bootstrap 4 is an unordered list that has a number of elements by having the proper classes. You can certainly built upon it by using the other options that are accessible in the component.
• Active stuffs: You can surely focus on the current active selection through just simply adding the .active
command to a .list-group-item
. This is handy for whenever you need to develop a list of materials that is clickable.
• Disabled elements: You can certainly as well de-highlight a list item to make it show up as though it has been certainly disabled. You just will have to bring in the .disabled
extension to the .list-group-item
for accomplishing this.
• Urls and Buttons: Using the buttons tag, you can quite easily develop an workable object within the Bootstrap List Item which means that you will certainly be able to include hover, active, and disabled states to these objects through making use of the .list-group-item-action
option. { You may split these types of pseudo-classes from the remaining classes to assure that the non-interactive features in your code such as <div>
-s or <lis>
s are not really clickable or workable too. It is advised that you do not actually employ the typical button classes such as .btn
here.
• Contextual classes: This is one more awesome element that becomes part of the list group component which allows you to style each and every list item having a definitive color and background. These are specifically useful for feature particular objects or sorting them according to color-'s code.
• • Badges: You can in addition add badges to a list object to present the unread counts, activity on the thing, and make it easy for some other active components with the use of some other utilities.
One of the most common list group is an unordered list along with list elements and the proper classes. Build on it through the approaches that follow, or even with your particular CSS as wished.
<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>
Amplify a .active
to a .list-group-item
to identify the current 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>
Put in .disabled
to a .list-group-item
to earn it appear like disabled. Consider that several components with are going to as well need custom JavaScript to entirely turn off their click events (e.g., web 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>
Use <a>
-s or else <button>
-s to build workable list group items with hover, disabled, and active conditions via adding .list-group-item-action
. We separate these pseudo-classes to make certain list groups constructed from non-interactive components (like <li>
-s or even <div>
-s) do not provide a select or perhaps tap affordance.
Don't forget to not work with the standard .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>
By <button>
-s, you are able to as well use the disabled
feature as an alternative to .disabled
the class. Sad to say, <a>
-s do not 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 form list items by using a stateful background plus 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 also do the job with .list-group-item-action
. Note the accession of the hover formats here not present in the last situation. In addition supported is the .active
; implement it to identify an active selection on a contextual list group object.
<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>
Using color to add indicating simply produces a graphic signal, that will definitely not be conveyed to users of assistive technological innovations -- such as screen readers. Make sure that info signified via the colour is either clear directly from the content in itself (e.g. the noticeable text message), or else is provided via different solutions, just like added text hidden having the .sr-only
class.
Put in badges to any sort of list group element to reveal unread sums, activity, and even more using several 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>
Incorporate basically any type of HTML within, even for linked list groups such as the one listed below, using 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>
All in all, list group is a robust and helpful component in Bootstrap 4 which empowers you to make an unordered list a lot more planned, interactive, and responsive free from ruining on the appearance or layout of the list objects themselves.
Bootstrap list training
Bootstrap list problem