List Group
Bootstrap 5 List Group component
Responsive list groups built with the latest Bootstrap 5. List groups are responsive components for displaying a series of content. A beautiful alternative to unordered lists.
List groups are a flexible and powerful component for displaying a series of content. Modify and extend them to support just about any content within.
Note: Read the API tab to find all available options and advanced customization
Basic example
The most basic list group is an unordered list with list items and the proper classes. Build upon it with the options that follow, or with your own CSS as needed.
- An item
- A second item
- A third item
- A fourth item
- And a fifth one
<ul class="list-group list-group-light">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
<li class="list-group-item">A fourth item</li>
<li class="list-group-item">And a fifth one</li>
</ul>
Small
If you need a more compact list, add a class .list-group-small
which will reduce the padding of the items in the list.
- An item
- A second item
- A third item
- A fourth item
- And a fifth one
<ul class="list-group list-group-light list-group-small">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
<li class="list-group-item">A fourth item</li>
<li class="list-group-item">And a fifth one</li>
</ul>
Active items
Add .active
to a .list-group-item
to indicate the current active
selection. You also need to add extra padding with spacing classes to keep the text from sticking to the edge of the list and .border-0
to remove borders between items.
- An active item
- A second item
- A third item
- A fourth item
- And a fifth one
<ul class="list-group list-group-light">
<li class="list-group-item px-3 border-0 active" aria-current="true">
An active item
</li>
<li class="list-group-item px-3 border-0">A second item</li>
<li class="list-group-item px-3 border-0">A third item</li>
<li class="list-group-item px-3 border-0">A fourth item</li>
<li class="list-group-item px-3 border-0">And a fifth one</li>
</ul>
Disabled items
Add .disabled
to a .list-group-item
to make it
appear disabled. Note that some elements with .disabled
will also
require custom JavaScript to fully disable their click events (e.g., links).
- An disabled item
- A second item
- A third item
- A fourth item
- And a fifth one
<ul class="list-group list-group-light">
<li class="list-group-item disabled" aria-disabled="true">An disabled item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
<li class="list-group-item">A fourth item</li>
<li class="list-group-item">And a fifth one</li>
</ul>
No borders
Add .border-0
to the items to remove all the borders.
- An item
- A second item
- A third item
- A fourth item
- And a fifth one
<ul class="list-group list-group-light">
<li class="list-group-item border-0">An item</li>
<li class="list-group-item border-0">A second item</li>
<li class="list-group-item border-0">A third item</li>
<li class="list-group-item border-0">A fourth item</li>
<li class="list-group-item border-0">And a fifth one</li>
</ul>
Numbered
Add the .list-group-numbered
modifier class (and optionally use an
<ol>
element) to opt into numbered list group items. Numbers are
generated via CSS (as opposed to a <ol>
s default browser styling) for
better placement inside list group items and to allow for better customization.
Numbers are generated by counter-reset
on the <ol>
, and then
styled and placed with a ::before
psuedo-element on the
<li>
with counter-increment
and content
.
- A list item
- A list item
- A list item
<ol class="list-group list-group-light list-group-numbered">
<li class="list-group-item">A list item</li>
<li class="list-group-item">A list item</li>
<li class="list-group-item">A list item</li>
</ol>
These work great with custom content as well.
-
SubheadingContent for list item
-
SubheadingContent for list item
-
SubheadingContent for list item
<ol class="list-group list-group-light list-group-numbered">
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
<div class="fw-bold">Subheading</div>
Content for list item
</div>
<span class="badge badge-primary rounded-pill">14</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
<div class="fw-bold">Subheading</div>
Content for list item
</div>
<span class="badge badge-primary rounded-pill">14</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
<div class="fw-bold">Subheading</div>
Content for list item
</div>
<span class="badge badge-primary rounded-pill">14</span>
</li>
</ol>
Horizontal
Add .list-group-horizontal
to change the layout of list group items from
vertical to horizontal across all breakpoints. Alternatively, choose a responsive variant
.list-group-horizontal-{sm|md|lg|xl|xxl}
to make a list group horizontal
starting at that breakpoint’s min-width
. Currently
horizontal list groups cannot be combined with flush or light list groups.
ProTip: Want equal-width list group items when horizontal? Add
.flex-fill
to each list group item.
- An item
- A second item
- A third item
- An item
- A second item
- A third item
- An item
- A second item
- A third item
- An item
- A second item
- A third item
- An item
- A second item
- A third item
- An item
- A second item
- A third item
<ul class="list-group list-group-horizontal">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-sm">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-md">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-lg">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-xl">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-xxl">
<li class="list-group-item">An item</li>
<li class="list-group-item">A second item</li>
<li class="list-group-item">A third item</li>
</ul>
Contextual classes
Use contextual classes to style list items with a stateful background and color.
- A simple default list group item
- A simple primary list group item
- A simple secondary list group item
- A simple success list group item
- A simple danger list group item
- A simple warning list group item
- A simple info list group item
- A simple light list group item
- A simple dark list group item
<ul class="list-group list-group-light">
<li class="list-group-item px-3 border-0 rounded-3 mb-2">A simple default list group item</li>
<li class="list-group-item px-3 border-0 rounded-3 list-group-item-primary mb-2">A simple primary list group item</li>
<li class="list-group-item px-3 border-0 rounded-3 list-group-item-secondary mb-2">A simple secondary list group item</li>
<li class="list-group-item px-3 border-0 rounded-3 list-group-item-success mb-2">A simple success list group item</li>
<li class="list-group-item px-3 border-0 rounded-3 list-group-item-danger mb-2">A simple danger list group item</li>
<li class="list-group-item px-3 border-0 rounded-3 list-group-item-warning mb-2">A simple warning list group item</li>
<li class="list-group-item px-3 border-0 rounded-3 list-group-item-info mb-2">A simple info list group item</li>
<li class="list-group-item px-3 border-0 rounded-3 list-group-item-light mb-2">A simple light list group item</li>
<li class="list-group-item px-3 border-0 rounded-3 list-group-item-dark mb-2">A simple dark list group item</li>
</ul>
Contextual classes also work with .list-group-item-action
. Note the addition of
the hover styles here not present in the previous example. Also supported is the
.active
state; apply it to indicate an active selection on a contextual list
group item.
<div class="list-group list-group-light">
<a href="#" class="list-group-item list-group-item-action px-3 border-0 rounded-3 mb-2">
A simple default list group item</a>
<a href="#" class="list-group-item list-group-item-action px-3 border-0 rounded-3 mb-2 list-group-item-primary">
A simple primary list group item</a>
<a href="#" class="list-group-item list-group-item-action px-3 border-0 rounded-3 mb-2 list-group-item-secondary">
A simple secondary list group item</a>
<a href="#" class="list-group-item list-group-item-action px-3 border-0 rounded-3 mb-2 list-group-item-success">
A simple success list group item</a>
<a href="#" class="list-group-item list-group-item-action px-3 border-0 rounded-3 mb-2 list-group-item-danger">
A simple danger list group item</a>
<a href="#" class="list-group-item list-group-item-action px-3 border-0 rounded-3 mb-2 list-group-item-warning">
A simple warning list group item</a>
<a href="#" class="list-group-item list-group-item-action px-3 border-0 rounded-3 mb-2 list-group-item-info">
A simple info list group item</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-light">
A simple light list group item</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-dark">
simple dark list group item</a>
</div>
Conveying meaning to assistive technologies:
Using color to add meaning only provides a visual indication, which will not be conveyed to
users of assistive technologies – such as screen readers. Ensure that information denoted by
the color is either obvious from the content itself (e.g. the visible text), or is included
through alternative means, such as additional text hidden with the
.visually-hidden
class.
Badges
Add badges to any list group item to show unread counts, activity, and more with the help of some flexbox utilities.
- A list item 14
- A second list item 2
- A third list item 1
<ul class="list-group list-group-light">
<li class="list-group-item d-flex justify-content-between align-items-center">
A list item
<span class="badge badge-primary rounded-pill">14</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
A second list item
<span class="badge badge-primary rounded-pill">2</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
A third list item
<span class="badge badge-primary rounded-pill">1</span>
</li>
</ul>
Custom content
Add nearly any HTML within, even for linked list groups like the one below, with the help of flexbox utilities.
-
John Doejohn.doe@gmail.com
-
Alex Rayalex.ray@gmail.com
-
Kate Huningtonkate.hunington@gmail.com
<ul class="list-group list-group-light">
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<div class="fw-bold">John Doe</div>
<div class="text-muted">john.doe@gmail.com</div>
</div>
<span class="badge rounded-pill badge-success">Active</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<div class="fw-bold">Alex Ray</div>
<div class="text-muted">alex.ray@gmail.com</div>
</div>
<span class="badge rounded-pill badge-primary">Onboarding</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<div class="fw-bold">Kate Hunington</div>
<div class="text-muted">kate.hunington@gmail.com</div>
</div>
<span class="badge rounded-pill badge-warning">Awaiting</span>
</li>
</ul>
Checkboxes
Place Bootstrap’s checkboxes and radios within list group items and customize as needed. You
can use them without <label>
s, but please remember to include an
aria-label
attribute and value for accessibility.
- First checkbox
- Second checkbox
- Third checkbox
- Fourth checkbox
- Fifth checkbox
<ul class="list-group list-group-light">
<li class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="" aria-label="..." />
First checkbox
</li>
<li class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="" aria-label="..." />
Second checkbox
</li>
<li class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="" aria-label="..." />
Third checkbox
</li>
<li class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="" aria-label="..." />
Fourth checkbox
</li>
<li class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="" aria-label="..." />
Fifth checkbox
</li>
</ul>
And if you want <label>
s as the .list-group-item
for large
hit areas, you can do that, too.
<div class="list-group list-group-light">
<li class="list-group-item">
<input class="form-check-input" type="checkbox" value="" id="checkboxExample1" />
<label class="form-check-label" for="checkboxExample1">First checkbox</label>
</li>
<li class="list-group-item">
<input class="form-check-input" type="checkbox" value="" id="checkboxExample2" />
<label class="form-check-label" for="checkboxExample2">Second checkbox</label>
</li>
<li class="list-group-item">
<input class="form-check-input" type="checkbox" value="" id="checkboxExample3" />
<label class="form-check-label" for="checkboxExample3">Third checkbox</label>
</li>
<li class="list-group-item">
<input class="form-check-input" type="checkbox" value="" id="checkboxExample4" />
<label class="form-check-label" for="checkboxExample4">Fourth checkbox</label>
</li>
<li class="list-group-item">
<input class="form-check-input" type="checkbox" value="" id="checkboxExample5" />
<label class="form-check-label" for="checkboxExample5">Fifth checkbox</label>
</li>
</div>
JavaScript behavior
Use the tab JavaScript plugin to extend our list group to create tabbable panes of local content.
<div class="row">
<div class="col-4">
<div class="list-group list-group-light" id="list-tab" role="tablist">
<a class="list-group-item list-group-item-action active px-3 border-0" id="list-home-list"
data-mdb-toggle="list" href="#list-home" role="tab" aria-controls="list-home">Home</a>
<a class="list-group-item list-group-item-action px-3 border-0" id="list-profile-list"
data-mdb-toggle="list" href="#list-profile" role="tab" aria-controls="list-profile">Profile</a>
<a class="list-group-item list-group-item-action px-3 border-0" id="list-messages-list"
data-mdb-toggle="list" href="#list-messages" role="tab" aria-controls="list-messages">Messages</a>
<a class="list-group-item list-group-item-action px-3 border-0" id="list-settings-list"
data-mdb-toggle="list" href="#list-settings" role="tab" aria-controls="list-settings">Settings</a>
</div>
</div>
<div class="col-8">
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="list-home" role="tabpanel"
aria-labelledby="list-home-list">
Some placeholder content in a paragraph relating to "Home". And some more content, used here just to
pad out and fill this tab panel. In production, you would obviously have more real content here. And
not just text. It could be anything, really. Text, images, forms.
</div>
<div class="tab-pane fade" id="list-profile" role="tabpanel" aria-labelledby="list-profile-list">
Some placeholder content in a paragraph relating to "Profile". And some more content, used here just
to pad out and fill this tab panel. In production, you would obviously have more real content here.
And not just text. It could be anything, really. Text, images, forms.
</div>
<div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list">
Some placeholder content in a paragraph relating to "Messages". And some more content, used here
just to pad out and fill this tab panel. In production, you would obviously have more real content
here. And not just text. It could be anything, really. Text, images, forms.
</div>
<div class="tab-pane fade" id="list-settings" role="tabpanel" aria-labelledby="list-settings-list">
Some placeholder content in a paragraph relating to "Settings". And some more content, used here
just to pad out and fill this tab panel. In production, you would obviously have more real content
here. And not just text. It could be anything, really. Text, images, forms.
</div>
</div>
</div>
</div>
Fade effect
To make tabs panel fade in, add .fade
to each .tab-pane
. The
first tab pane must also have .show
to make the initial content visible.
<div class="tab-content">
<div class="tab-pane fade show active" id="home" role="tabpanel">...</div>
<div class="tab-pane fade" id="profile" role="tabpanel">...</div>
<div class="tab-pane fade" id="messages" role="tabpanel">...</div>
<div class="tab-pane fade" id="settings" role="tabpanel">...</div>
</div>
Additional examples
A few additional, practical examples with different types of content and elements.
Images
-
John Doe
john.doe@gmail.com
-
Alex Ray
alex.ray@gmail.com
-
Kate Hunington
kate.hunington@gmail.com
<ul class="list-group list-group-light">
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="https://mdbootstrap.com/img/new/avatars/8.jpg" alt="" style="width: 45px; height: 45px"
class="rounded-circle" />
<div class="ms-3">
<p class="fw-bold mb-1">John Doe</p>
<p class="text-muted mb-0">john.doe@gmail.com</p>
</div>
</div>
<span class="badge rounded-pill badge-success">Active</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="https://mdbootstrap.com/img/new/avatars/6.jpg" class="rounded-circle" alt=""
style="width: 45px; height: 45px" />
<div class="ms-3">
<p class="fw-bold mb-1">Alex Ray</p>
<p class="text-muted mb-0">alex.ray@gmail.com</p>
</div>
</div>
<span class="badge rounded-pill badge-primary">Onboarding</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="https://mdbootstrap.com/img/new/avatars/7.jpg" class="rounded-circle" alt=""
style="width: 45px; height: 45px" />
<div class="ms-3">
<p class="fw-bold mb-1">Kate Hunington</p>
<p class="text-muted mb-0">kate.hunington@gmail.com</p>
</div>
</div>
<span class="badge rounded-pill badge-warning">Awaiting</span>
</li>
</ul>
Headings
Marketing team
-
John Doe
john.doe@gmail.com
-
Alex Ray
alex.ray@gmail.com
-
Kate Hunington
kate.hunington@gmail.com
Design team
-
Soraya Letto
soraya.letto@gmail.com
-
Zeynep Dudley
zeynep.dudley@gmail.com
-
Ayat Black
ayat.black@gmail.com
<h6 class="bg-light p-2 border-top border-bottom">Marketing team</h6>
<ul class="list-group list-group-light mb-4">
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="https://mdbootstrap.com/img/new/avatars/8.jpg" alt="" style="width: 45px; height: 45px"
class="rounded-circle" />
<div class="ms-3">
<p class="fw-bold mb-1">John Doe</p>
<p class="text-muted mb-0">john.doe@gmail.com</p>
</div>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="https://mdbootstrap.com/img/new/avatars/6.jpg" class="rounded-circle" alt=""
style="width: 45px; height: 45px" />
<div class="ms-3">
<p class="fw-bold mb-1">Alex Ray</p>
<p class="text-muted mb-0">alex.ray@gmail.com</p>
</div>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="https://mdbootstrap.com/img/new/avatars/7.jpg" class="rounded-circle" alt=""
style="width: 45px; height: 45px" />
<div class="ms-3">
<p class="fw-bold mb-1">Kate Hunington</p>
<p class="text-muted mb-0">kate.hunington@gmail.com</p>
</div>
</div>
</li>
</ul>
<h6 class="bg-light p-2 border-top border-bottom">Design team</h6>
<ul class="list-group list-group-light">
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="https://mdbootstrap.com/img/new/avatars/9.jpg" alt="" style="width: 45px; height: 45px"
class="rounded-circle" />
<div class="ms-3">
<p class="fw-bold mb-1">Soraya Letto</p>
<p class="text-muted mb-0">soraya.letto@gmail.com</p>
</div>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="https://mdbootstrap.com/img/new/avatars/11.jpg" class="rounded-circle" alt=""
style="width: 45px; height: 45px" />
<div class="ms-3">
<p class="fw-bold mb-1">Zeynep Dudley</p>
<p class="text-muted mb-0">zeynep.dudley@gmail.com</p>
</div>
</div>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="https://mdbootstrap.com/img/new/avatars/15.jpg" class="rounded-circle" alt=""
style="width: 45px; height: 45px" />
<div class="ms-3">
<p class="fw-bold mb-1">Ayat Black</p>
<p class="text-muted mb-0">ayat.black@gmail.com</p>
</div>
</div>
</li>
</ul>
CTA
-
Our company starts its operations
11 March 2020
Some placeholder content in a paragraph relating to "Our company starts its operations". And some more content, used here just to pad out and fill this tab panel. In production, you would obviously have more real content here. And not just text. It could be anything, really. Text, images, forms.
-
First customer
19 March 2020
Some placeholder content in a paragraph relating to "First customer". And some more content, used here just to pad out and fill this tab panel. In production, you would obviously have more real content here. And not just text. It could be anything, really. Text, images, forms.
-
Our team exceeds 10 people
24 June 2020
Some placeholder content in a paragraph relating to "Our team exceeds 10 people". And some more content, used here just to pad out and fill this tab panel. In production, you would obviously have more real content here. And not just text. It could be anything, really. Text, images, forms.
<ul class="list-group list-group-light mb-3">
<li class="list-group-item">
<h5 class="fw-bold">Our company starts its operations</h5>
<p class="text-muted mb-2 fw-bold">11 March 2020</p>
<p class="text-muted mb-0">
Some placeholder content in a paragraph relating to "Our company starts its operations". And some
more content, used here just to pad out and fill this tab panel. In production, you would obviously
have more real content here. And not just text. It could be anything, really. Text, images, forms.
</p>
</li>
<li class="list-group-item">
<h5 class="fw-bold">First customer</h5>
<p class="text-muted mb-2 fw-bold">19 March 2020</p>
<p class="text-muted mb-0">
Some placeholder content in a paragraph relating to "First customer". And some more content,
used here just to pad out and fill this tab panel. In production, you would obviously have more real
content here. And not just text. It could be anything, really. Text, images, forms.
</p>
</li>
<li class="list-group-item">
<h5 class="fw-bold">Our team exceeds 10 people</h5>
<p class="text-muted mb-2 fw-bold">24 June 2020</p>
<p class="text-muted mb-0">
Some placeholder content in a paragraph relating to "Our team exceeds 10 people". And some more
content, used here just to pad out and fill this tab panel. In production, you would obviously
have more real content here. And not just text. It could be anything, really. Text, images, forms.
</p>
</li>
</ul>
<a class="btn btn-outline-dark btn-rounded w-100" href="#" role="button" data-ripple-color="dark">View all</a>
Grid list
John Doe
john.doe@gmail.com
Alex Ray
alex.ray@gmail.com
Kate Hunington
kate.hunington@gmail.com
Soraya Letto
soraya.letto@gmail.com
Zeynep Dudley
zeynep.dudley@gmail.com
Ayat Black
ayat.black@gmail.com
<div class="row">
<div class="col-xl-4 col-lg-6 mb-4">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<img
src="https://mdbootstrap.com/img/new/avatars/8.jpg"
alt=""
style="width: 45px; height: 45px"
class="rounded-circle"
/>
<div class="ms-3">
<p class="fw-bold mb-1">John Doe</p>
<p class="text-muted mb-0">john.doe@gmail.com</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-4 col-lg-6 mb-4">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<img
src="https://mdbootstrap.com/img/new/avatars/6.jpg"
alt=""
style="width: 45px; height: 45px"
class="rounded-circle"
/>
<div class="ms-3">
<p class="fw-bold mb-1">Alex Ray</p>
<p class="text-muted mb-0">alex.ray@gmail.com</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-4 col-lg-6 mb-4">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<img
src="https://mdbootstrap.com/img/new/avatars/7.jpg"
alt=""
style="width: 45px; height: 45px"
class="rounded-circle"
/>
<div class="ms-3">
<p class="fw-bold mb-1">Kate Hunington</p>
<p class="text-muted mb-0">kate.hunington@gmail.com</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-4 col-lg-6 mb-4">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<img
src="https://mdbootstrap.com/img/new/avatars/9.jpg"
alt=""
style="width: 45px; height: 45px"
class="rounded-circle"
/>
<div class="ms-3">
<p class="fw-bold mb-1">Soraya Letto</p>
<p class="text-muted mb-0">soraya.letto@gmail.com</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-4 col-lg-6 mb-4">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<img
src="https://mdbootstrap.com/img/new/avatars/11.jpg"
alt=""
style="width: 45px; height: 45px"
class="rounded-circle"
/>
<div class="ms-3">
<p class="fw-bold mb-1">Zeynep Dudley</p>
<p class="text-muted mb-0">zeynep.dudley@gmail.com</p>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-4 col-lg-6 mb-4">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center">
<img
src="https://mdbootstrap.com/img/new/avatars/15.jpg"
alt=""
style="width: 45px; height: 45px"
class="rounded-circle"
/>
<div class="ms-3">
<p class="fw-bold mb-1">Ayat Black</p>
<p class="text-muted mb-0">ayat.black@gmail.com</p>
</div>
</div>
</div>
</div>
</div>
</div>
Complex grid list
John Doe
john.doe@gmail.com
Alex Ray
alex.ray@gmail.com
Kate Hunington
kate.hunington@gmail.com
Michael Bale
michael.bale@gmail.com
<div class="row">
<div class="col-xl-6 mb-4">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img
src="https://mdbootstrap.com/img/new/avatars/8.jpg"
alt=""
style="width: 45px; height: 45px"
class="rounded-circle"
/>
<div class="ms-3">
<p class="fw-bold mb-1">John Doe</p>
<p class="text-muted mb-0">john.doe@gmail.com</p>
</div>
</div>
<span class="badge rounded-pill badge-success">Active</span>
</div>
</div>
<div
class="card-footer border-0 bg-light p-2 d-flex justify-content-around"
>
<a
class="btn btn-link m-0 text-reset"
href="#"
role="button"
data-ripple-color="primary"
>Message<i class="fas fa-envelope ms-2"></i
></a>
<a
class="btn btn-link m-0 text-reset"
href="#"
role="button"
data-ripple-color="primary"
>Call<i class="fas fa-phone ms-2"></i
></a>
</div>
</div>
</div>
<div class="col-xl-6 mb-4">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img
src="https://mdbootstrap.com/img/new/avatars/6.jpg"
alt=""
style="width: 45px; height: 45px"
class="rounded-circle"
/>
<div class="ms-3">
<p class="fw-bold mb-1">Alex Ray</p>
<p class="text-muted mb-0">alex.ray@gmail.com</p>
</div>
</div>
<span class="badge rounded-pill badge-primary"
>Onboarding</span
>
</div>
</div>
<div
class="card-footer border-0 bg-light p-2 d-flex justify-content-around"
>
<a
class="btn btn-link m-0 text-reset"
href="#"
role="button"
data-ripple-color="primary"
>Message<i class="fas fa-envelope ms-2"></i
></a>
<a
class="btn btn-link m-0 text-reset"
href="#"
role="button"
data-ripple-color="primary"
>Call<i class="fas fa-phone ms-2"></i
></a>
</div>
</div>
</div>
<div class="col-xl-6 mb-4">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img
src="https://mdbootstrap.com/img/new/avatars/7.jpg"
alt=""
style="width: 45px; height: 45px"
class="rounded-circle"
/>
<div class="ms-3">
<p class="fw-bold mb-1">Kate Hunington</p>
<p class="text-muted mb-0">kate.hunington@gmail.com</p>
</div>
</div>
<span class="badge rounded-pill badge-warning">Awaiting</span>
</div>
</div>
<div
class="card-footer border-0 bg-light p-2 d-flex justify-content-around"
>
<a
class="btn btn-link m-0 text-reset"
href="#"
role="button"
data-ripple-color="primary"
>Message<i class="fas fa-envelope ms-2"></i
></a>
<a
class="btn btn-link m-0 text-reset"
href="#"
role="button"
data-ripple-color="primary"
>Call<i class="fas fa-phone ms-2"></i
></a>
</div>
</div>
</div>
<div class="col-xl-6 mb-4">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img
src="https://mdbootstrap.com/img/new/avatars/3.jpg"
alt=""
style="width: 45px; height: 45px"
class="rounded-circle"
/>
<div class="ms-3">
<p class="fw-bold mb-1">Michael Bale</p>
<p class="text-muted mb-0">michael.bale@gmail.com</p>
</div>
</div>
<span class="badge rounded-pill badge-danger">Removed</span>
</div>
</div>
<div
class="card-footer border-0 bg-light p-2 d-flex justify-content-around"
>
<a
class="btn btn-link m-0 text-reset"
href="#"
role="button"
data-ripple-color="primary"
>Message<i class="fas fa-envelope ms-2"></i
></a>
<a
class="btn btn-link m-0 text-reset"
href="#"
role="button"
data-ripple-color="primary"
>Call<i class="fas fa-phone ms-2"></i
></a>
</div>
</div>
</div>
</div>
List Group - API
Usage
Using data attributes
You can activate a list group navigation without writing any JavaScript by simply specifying
data-mdb-toggle="list"
or on an element. Use these data attributes on
.list-group-item
.
<!-- List group -->
<div class="list-group" id="myList" role="tablist">
<a class="list-group-item list-group-item-action active" data-mdb-toggle="list" href="#home" role="tab">Home</a>
<a class="list-group-item list-group-item-action" data-mdb-toggle="list" href="#profile" role="tab">Profile</a>
<a class="list-group-item list-group-item-action" data-mdb-toggle="list" href="#messages" role="tab">Messages</a>
<a class="list-group-item list-group-item-action" data-mdb-toggle="list" href="#settings" role="tab">Settings</a>
</div>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="home" role="tabpanel">...</div>
<div class="tab-pane" id="profile" role="tabpanel">...</div>
<div class="tab-pane" id="messages" role="tabpanel">...</div>
<div class="tab-pane" id="settings" role="tabpanel">...</div>
</div>
Via JavaScript
Enable tabbable list item via JavaScript (each list item needs to be activated individually):
const triggerTabList = [].slice.call(document.querySelectorAll('#myTab a'))
triggerTabList.forEach((triggerEl) => {
const tabTrigger = new mdb.Tab(triggerEl)
triggerEl.addEventListener('click', (e) => {
e.preventDefault()
tabTrigger.show()
})
})
You can activate individual list item in several ways:
// Select tab by name
const triggerEl = document.querySelector('#myTab a[href="#profile"]');
mdb.Tab.getInstance(triggerEl).show()
// Select first tab
const triggerFirstTabEl = document.querySelector('#myTab li:first-child a')
mdb.Tab.getInstance(triggerFirstTabEl).show()
Methods
Method | Description | Example |
---|---|---|
show |
Selects the given list item and shows its associated pane. Any other list item that was
previously selected becomes unselected and its associated pane is hidden.
Returns to the caller before the tab pane has actually been shown
(for example, before the shown.mdb.tab event occurs).
|
instance.show() |
dispose |
Destroys an element’s tab. | instance.dispose() |
getInstance |
Static method which allows you to get the tab instance associated with a DOM element. | Tab.getInstance() |
getOrCreateInstance |
Static method which allows you to get the tab instance associated with a DOM element or create a new one in case it wasn't initialized. | Tab.getOrCreateInstance() |
const triggerEl = document.querySelector('#trigger')
const tab = new mdb.Tab(triggerEl);
tab.show()
Events
When showing a new tab, the events fire in the following order:
hide.mdb.tab
(on the current active tab)show.mdb.tab
(on the to-be-shown tab)-
hidden.mdb.tab
(on the previous active tab, the same one as for thehide.mdb.tab
event) -
shown.mdb.tab
(on the newly-active just-shown tab, the same one as for theshow.mdb.tab
event)
If no tab was already active, the hide.mdb.tab
and
hidden.mdb.tab
events will not be fired.
Event type | Description |
---|---|
show.mdb.tab |
This event fires on tab show, but before the new tab has been shown. Use
event.target and event.relatedTarget to target the active tab
and the previous active tab (if available) respectively.
|
shown.mdb.tab |
This event fires on tab show after a tab has been shown. Use
event.target and event.relatedTarget to target the active tab
and the previous active tab (if available) respectively.
|
hide.mdb.tab |
This event fires when a new tab is to be shown (and thus the previous active tab is to
be hidden). Use event.target and event.relatedTarget to target
the current active tab and the new soon-to-be-active tab, respectively.
|
hidden.mdb.tab |
This event fires after a new tab is shown (and thus the previous active tab is hidden).
Use event.target and event.relatedTarget to target the
previous active tab and the new active tab, respectively.
|
const tabEls = document.querySelectorAll('a[data-mdb-toggle="list"]')
tabEls.forEach((tabEl) => {
tabEl.addEventListener('shown.mdb.tab', (e) => {
e.target // newly activated tab
e.relatedTarget // previous active tab
})
})
Import
MDB UI KIT also works with module bundlers. Use the following code to import this component:
import { Tab } from 'mdb-ui-kit';
CSS variables
As part of MDB’s evolving CSS variables approach, list group now uses local CSS variables on
.list-group
for enhanced real-time customization. Values for the CSS variables
are set via Sass, so Sass customization is still supported, too.
// .list-group
--#{$prefix}list-group-color: #{$list-group-color};
--#{$prefix}list-group-bg: #{$list-group-bg};
--#{$prefix}list-group-border-color: #{$list-group-border-color};
--#{$prefix}list-group-border-width: #{$list-group-border-width};
--#{$prefix}list-group-border-radius: #{$list-group-border-radius};
--#{$prefix}list-group-item-padding-x: #{$list-group-item-padding-x};
--#{$prefix}list-group-item-padding-y: #{$list-group-item-padding-y};
--#{$prefix}list-group-item-transition-time: #{$list-group-item-transition-time};
--#{$prefix}list-group-action-color: #{$list-group-action-color};
--#{$prefix}list-group-action-hover-color: #{$list-group-action-hover-color};
--#{$prefix}list-group-action-hover-bg: #{$list-group-hover-bg};
--#{$prefix}list-group-action-active-color: #{$list-group-action-active-color};
--#{$prefix}list-group-action-active-bg: #{$list-group-action-active-bg};
--#{$prefix}list-group-disabled-color: #{$list-group-disabled-color};
--#{$prefix}list-group-disabled-bg: #{$list-group-disabled-bg};
--#{$prefix}list-group-active-color: #{$list-group-active-color};
--#{$prefix}list-group-active-bg: #{$list-group-active-bg};
--#{$prefix}list-group-active-border-color: #{$list-group-active-border-color};
// .list-group-light
--#{$prefix}list-group-light-item-py: #{$list-group-light-item-py};
--#{$prefix}list-group-light-item-border: #{$list-group-light-item-border};
--#{$prefix}list-group-light-item-border-width: #{$list-group-light-item-border-width};
--#{$prefix}list-group-light-active-border-radius: #{$list-group-light-active-border-radius};
--#{$prefix}list-group-light-active-bg: #{$list-group-light-active-bg};
--#{$prefix}list-group-light-active-color: #{$list-group-light-active-color};
// .list-group-small
--#{$prefix}list-group-small-item-py: #{$list-group-small-item-py};
SCSS variables
$list-group-border-radius: $border-radius-lg;
$list-group-border-color: rgba($black, 0.125);
$list-group-border-width: $border-width;
$list-group-item-padding-x: 1.5rem;
$list-group-item-padding-y: $spacer * 0.5;
$list-group-item-bg-scale: -80%;
$list-group-item-color-scale: 40%;
$list-group-item-transition-time: 0.5s;
$list-group-color: $body-color;
$list-group-light-item-py: 1rem;
$list-group-light-item-border: 2px solid hsl(0, 0%, 96%);
$list-group-light-item-border-width: 2px;
$list-group-light-active-border-radius: 0.5rem;
$list-group-light-active-bg: rgb(223, 231, 246);
$list-group-light-active-color: rgb(44, 88, 160);
$list-group-small-item-py: 0.5rem;
$list-group-active-bg: rgb(223, 231, 246);
$list-group-active-color: rgb(44, 88, 160);
$list-group-active-border-color: $list-group-active-bg;
$list-group-color: $gray-900;
$list-group-bg: $white;
$list-group-hover-bg: $gray-100;
$list-group-active-color: $component-active-color;
$list-group-active-bg: $component-active-bg;
$list-group-active-border-color: $list-group-active-bg;
$list-group-disabled-color: $gray-600;
$list-group-disabled-bg: $list-group-bg;
$list-group-action-color: $gray-700;
$list-group-action-hover-color: $list-group-action-color;
$list-group-action-active-color: $body-color;
$list-group-action-active-bg: $gray-200;