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.
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Porta ac consectetur ac
- Vestibulum at eros
<ul class="list-group list-group-light">
<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>
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.
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Porta ac consectetur ac
- Vestibulum at eros
<ul class="list-group list-group-light list-group-small">
<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>
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.
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Porta ac consectetur ac
- Vestibulum at eros
<ul class="list-group list-group-light">
<li class="list-group-item px-3 border-0 active" aria-current="true">
Cras justo odio
</li>
<li class="list-group-item px-3 border-0">Dapibus ac facilisis in</li>
<li class="list-group-item px-3 border-0">Morbi leo risus</li>
<li class="list-group-item px-3 border-0">Porta ac consectetur ac</li>
<li class="list-group-item px-3 border-0">Vestibulum at eros</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).
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Porta ac consectetur ac
- Vestibulum at eros
<ul class="list-group list-group-light">
<li class="list-group-item disabled" aria-disabled="true">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>
No borders
Add .border-0
to the items to remove all the borders.
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Porta ac consectetur ac
- Vestibulum at eros
<ul class="list-group list-group-light">
<li class="list-group-item border-0">Cras justo odio</li>
<li class="list-group-item border-0">Dapibus ac facilisis in</li>
<li class="list-group-item border-0">Morbi leo risus</li>
<li class="list-group-item border-0">Porta ac consectetur ac</li>
<li class="list-group-item border-0">Vestibulum at eros</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
.
- Cras justo odio
- Cras justo odio
- Cras justo odio
<ol class="list-group list-group-light list-group-numbered">
<li class="list-group-item">Cras justo odio</li>
<li class="list-group-item">Cras justo odio</li>
<li class="list-group-item">Cras justo odio</li>
</ol>
These work great with custom content as well.
-
SubheadingCras justo odio
-
SubheadingCras justo odio
-
SubheadingCras justo odio
<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>
Cras justo odio
</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>
Cras justo odio
</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>
Cras justo odio
</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.
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
<ul class="list-group list-group-horizontal">
<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>
</ul>
<ul class="list-group list-group-horizontal-sm">
<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>
</ul>
<ul class="list-group list-group-horizontal-md">
<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>
</ul>
<ul class="list-group list-group-horizontal-lg">
<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>
</ul>
<ul class="list-group list-group-horizontal-xl">
<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>
</ul>
<ul class="list-group list-group-horizontal-xxl">
<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>
</ul>
Contextual classes
Use contextual classes to style list items with a stateful background and color.
- Dapibus ac facilisis in
- 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">Dapibus ac facilisis in</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">Dapibus ac facilisis in</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 px-3 border-0 rounded-3 mb-2 list-group-item-light"
>A simple light 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-dark"
>A 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.
- Cras justo odio 14
- Dapibus ac facilisis in 2
- Morbi leo risus 1
<ul class="list-group list-group-light">
<li class="list-group-item d-flex justify-content-between align-items-center">
Cras justo odio
<span class="badge badge-primary rounded-pill">14</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
Dapibus ac facilisis in
<span class="badge badge-primary rounded-pill">2</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
Morbi leo risus
<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.
- Cras justo odio
- Dapibus ac facilisis in
- Morbi leo risus
- Porta ac consectetur ac
- Vestibulum at eros
<ul class="list-group list-group-light">
<li class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="" aria-label="..." />
Cras justo odio
</li>
<li class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="" aria-label="..." />
Dapibus ac facilisis in
</li>
<li class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="" aria-label="..." />
Morbi leo risus
</li>
<li class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="" aria-label="..." />
Porta ac consectetur ac
</li>
<li class="list-group-item">
<input class="form-check-input me-1" type="checkbox" value="" aria-label="..." />
Vestibulum at eros
</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">Cras justo odio</label>
</li>
<li class="list-group-item">
<input class="form-check-input" type="checkbox" value="" id="checkboxExample2" />
<label class="form-check-label" for="checkboxExample2">Dapibus ac facilisis in</label>
</li>
<li class="list-group-item">
<input class="form-check-input" type="checkbox" value="" id="checkboxExample3" />
<label class="form-check-label" for="checkboxExample3">Morbi leo risus</label>
</li>
<li class="list-group-item">
<input class="form-check-input" type="checkbox" value="" id="checkboxExample4" />
<label class="form-check-label" for="checkboxExample4">Porta ac consectetur ac</label>
</li>
<li class="list-group-item">
<input class="form-check-input" type="checkbox" value="" id="checkboxExample5" />
<label class="form-check-label" for="checkboxExample5">Vestibulum at eros</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">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Labore
impedit quibusdam exercitationem eligendi voluptate doloribus
non pariatur libero quod nobis mollitia odio dolore eos debitis
iure, autem quisquam ullam beatae.
</div>
<div class="tab-pane fade" id="list-profile" role="tabpanel" aria-labelledby="list-profile-list">
Ea eos asperiores deserunt reprehenderit voluptatem deleniti
dolor iure eum consectetur commodi.
</div>
<div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list">
Et perspiciatis facilis labore natus at necessitatibus. Sequi
earum qui illum reiciendis? Excepturi, dicta consequuntur,
voluptas aspernatur, quis laboriosam exercitationem quasi
officia tempore iste assumenda aliquam.
</div>
<div class="tab-pane fade" id="list-settings" role="tabpanel" aria-labelledby="list-settings-list">
Praesentium asperiores nemo ratione quas atque excepturi odio
aliquid libero, architecto aspernatur expedita, corrupti, rem
odit quos exercitationem maxime at. Ex, eveniet rerum laborum
accusamus delectus magnam maxime!
</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
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sit necessitatibus adipisci, ad alias, voluptate pariatur officia repellendus repellat inventore fugit perferendis totam dolor voluptas et corrupti distinctio maxime corporis optio?
-
First customer
19 March 2020
Quisque ornare dui nibh, sagittis egestas nisi luctus nec. Sed aliquet laoreet sapien, eget pulvinar lectus maximus vel. Phasellus suscipit porta mattis.
-
Our team exceeds 10 people
24 June 2020
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla ullamcorper arcu lacus, maximus facilisis erat pellentesque nec. Duis et dui maximus dui aliquam convallis. Quisque consectetur purus erat, et ullamcorper sapien tincidunt vitae.
<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">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sit
necessitatibus adipisci, ad alias, voluptate pariatur officia
repellendus repellat inventore fugit perferendis totam dolor
voluptas et corrupti distinctio maxime corporis optio?
</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">
Quisque ornare dui nibh, sagittis egestas nisi luctus nec. Sed
aliquet laoreet sapien, eget pulvinar lectus maximus vel.
Phasellus suscipit porta mattis.
</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">
Orci varius natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Nulla ullamcorper arcu lacus, maximus
facilisis erat pellentesque nec. Duis et dui maximus dui aliquam
convallis. Quisque consectetur purus erat, et ullamcorper sapien
tincidunt vitae.
</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 |
---|---|
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).
|
dispose |
Destroys an element’s tab. |
getInstance |
Static method which allows you to get the tab instance associated with a DOM element |
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';