Bootstrap Vue List Group Component

Bootstrap Vue List Group component allows displaying a series of content. Learn how to use Vue list group to build complex list structure on your website.

Basic example

The default list group is an unordered list with items and the proper CSS classes. Build upon it with the options that follow, or with your CSS as required.

  • Cras justo odio
  • Dapibus ac facilisis in
  • Morbi leo risus
  • Porta ac consectetur ac
  • Vestibulum at eros
<CListGroup>
  <CListGroupItem>Cras justo odio</CListGroupItem>
  <CListGroupItem>Dapibus ac facilisis in</CListGroupItem>
  <CListGroupItem>Morbi leo risus</CListGroupItem>
  <CListGroupItem>Porta ac consectetur ac</CListGroupItem>
  <CListGroupItem>Vestibulum at eros</CListGroupItem>
</CListGroup>
1
2
3
4
5
6
7

Active items

Add active boolean property to a <CListGroupItem> to show the current active selection.

  • Cras justo odio
  • Dapibus ac facilisis in
  • Morbi leo risus
  • Porta ac consectetur ac
  • Vestibulum at eros
<CListGroup>
  <CListGroupItem active>Cras justo odio</CListGroupItem>
  <CListGroupItem>Dapibus ac facilisis in</CListGroupItem>
  <CListGroupItem>Morbi leo risus</CListGroupItem>
  <CListGroupItem>Porta ac consectetur ac</CListGroupItem>
  <CListGroupItem>Vestibulum at eros</CListGroupItem>
</CListGroup>
1
2
3
4
5
6
7

Disabled items

Add disabled boolean property to a <CListGroupItem> to make it appear disabled.

  • Cras justo odio
  • Dapibus ac facilisis in
  • Morbi leo risus
  • Porta ac consectetur ac
  • Vestibulum at eros
<CListGroup>
  <CListGroupItem disabled>Cras justo odio</CListGroupItem>
  <CListGroupItem>Dapibus ac facilisis in</CListGroupItem>
  <CListGroupItem>Morbi leo risus</CListGroupItem>
  <CListGroupItem>Porta ac consectetur ac</CListGroupItem>
  <CListGroupItem>Vestibulum at eros</CListGroupItem>
</CListGroup>
1
2
3
4
5
6
7

Use <a>s or <button>s to create actionable list group items with hover, disabled, and active states by adding component="a|button". We separate these pseudo-classes to ensure list groups made of non-interactive elements (like <li>s or <div>s) don't provide a click or tap affordance.

<CListGroup>
  <CListGroupItem component="a" href="#" active>Cras justo odio</CListGroupItem>
  <CListGroupItem component="a" href="#">Dapibus ac facilisis in</CListGroupItem>
  <CListGroupItem component="a" href="#">Morbi leo risus</CListGroupItem>
  <CListGroupItem component="a" href="#">Porta ac consectetur ac</CListGroupItem>
  <CListGroupItem component="a" href="#" disabled>Vestibulum at eros</CListGroupItem>
</CListGroup>
1
2
3
4
5
6
7
<CListGroup>
  <CListGroupItem component="button" active>Cras justo odio</CListGroupItem>
  <CListGroupItem component="button">Dapibus ac facilisis in</CListGroupItem>
  <CListGroupItem component="button">Morbi leo risus</CListGroupItem>
  <CListGroupItem component="button">Porta ac consectetur ac</CListGroupItem>
  <CListGroupItem component="button" disabled>Vestibulum at eros</CListGroupItem>
</CListGroup>
1
2
3
4
5
6
7

Flush

Add flush boolean property to remove some borders and rounded corners to render list group items edge-to-edge in a parent container (e.g., cards).

  • Cras justo odio
  • Dapibus ac facilisis in
  • Morbi leo risus
  • Porta ac consectetur ac
  • Vestibulum at eros
<CListGroup flush>
  <CListGroupItem>Cras justo odio</CListGroupItem>
  <CListGroupItem>Dapibus ac facilisis in</CListGroupItem>
  <CListGroupItem>Morbi leo risus</CListGroupItem>
  <CListGroupItem>Porta ac consectetur ac</CListGroupItem>
  <CListGroupItem>Vestibulum at eros</CListGroupItem>
</CListGroup>
1
2
3
4
5
6
7

Horizontal

Add layout="horizontal" to change the layout of list group items from vertical to horizontal across all breakpoints. Alternatively, choose a responsive variant .layout="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 list groups.

  • 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
<template v-for="(item) in ['', '-sm', '-md', '-lg', '-xl', '-xxl']">
  <CListGroup class="mb-2" :layout="'horizontal' + item">
    <CListGroupItem>Cras justo odio</CListGroupItem>
    <CListGroupItem>Dapibus ac facilisis in</CListGroupItem>
    <CListGroupItem>Morbi leo risus</CListGroupItem>
  </CListGroup>
</template>
1
2
3
4
5
6
7

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
<CListGroup>
  <CListGroupItem>Dapibus ac facilisis in</CListGroupItem>
  <CListGroupItem v-for="(item) in ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']" :color="item">A simple {{item}} list group item</CListGroupItem>
</CListGroup>
1
2
3
4

Contextual classes also work with <a>s or <button>s. 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.

<CListGroup>
  <CListGroupItem component="a" href="#">Dapibus ac facilisis in</CListGroupItem>
  <CListGroupItem v-for="(item) in ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']" component="a" href="#" :color="item">A simple {{item}} list group item</CListGroupItem>
</CListGroup>
1
2
3
4
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.

With badges

Add badges to any list group item to show unread counts, activity, and more.

  • Cras justo odio14
  • Dapibus ac facilisis in2
  • Morbi leo risus1
<CListGroup>
  <CListGroupItem class="d-flex justify-content-between align-items-center">Cras justo odio<CBadge color="primary" shape="rounded-pill">14</CBadge></CListGroupItem>
  <CListGroupItem class="d-flex justify-content-between align-items-center">Dapibus ac facilisis in<CBadge color="primary" shape="rounded-pill">2</CBadge></CListGroupItem>
  <CListGroupItem class="d-flex justify-content-between align-items-center">Morbi leo risus<CBadge color="primary" shape="rounded-pill">1</CBadge></CListGroupItem>
</CListGroup>
1
2
3
4
5

Custom content

Add nearly any HTML within, even for linked list groups like the one below, with the help of flexbox utilitiesopen in new window.

<CListGroup>
  <CListGroupItem component="a" href="#" 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>
  </CListGroupItem>
  <CListGroupItem component="a" href="#">
    <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>
  </CListGroupItem>
  <CListGroupItem component="a" href="#">
    <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>
  </CListGroupItem>
</CListGroup>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

Checkboxes and radios

Place Bootstrap Vue's checkboxes and radios within list group items and customize as needed.

<CListGroup>
  <CListGroupItem><CFormCheck label="Cras justo odio"/></CListGroupItem>
  <CListGroupItem><CFormCheck label="Dapibus ac facilisis in" checked/></CListGroupItem>
  <CListGroupItem><CFormCheck label="Morbi leo risus" checked/></CListGroupItem>
  <CListGroupItem><CFormCheck label="orta ac consectetur ac"/></CListGroupItem>
  <CListGroupItem><CFormCheck label="Vestibulum at eros"/></CListGroupItem>
</CListGroup>
1
2
3
4
5
6
7

API

CListGroup

import { CListGroup } from '@coreui/bootstrap-vue'
// or
import CListGroup from '@coreui/bootstrap-vue/src/components/list-group/CListGroup'
1
2
3

Props

Prop nameDescriptionTypeValuesDefault
componentComponent used for the root node. Either a string to use a HTML element or a component.string-'ul'
flushRemove some borders and rounded corners to render list group items edge-to-edge in a parent component (e.g., <CCard>)boolean-
layoutSpecify a layout type.string'horizontal', 'horizontal-sm', 'horizontal-md', 'horizontal-lg', 'horizontal-xl', 'horizontal-xxl', ``-

CListGroupItem

import { CListGroupItem } from '@coreui/bootstrap-vue'
// or
import CListGroupItem from '@coreui/bootstrap-vue/src/components/list-group/CListGroupItem'
1
2
3

Props

Prop nameDescriptionTypeValuesDefault
activeToggle the active state for the component.boolean-
color* Sets the color context of the component to one of Bootstrap Vue’s themed colors.string'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light', string
disabledToggle the disabled state for the component.boolean-
componentComponent used for the root node. Either a string to use a HTML element or a component.string-'li'