🤩
Windframe Import Update is finally here.

LIstGroup

React Bootstrap 5 ListGroup

React Bootstrap 5 List group is a versatile component that can display both simple and complex custom information.

Importing the React Bootstrap 5 ListGroup component

Start by importing CDBListGroup into your project to use the Contrast React Bootstrap 5 ListGroup component. Then you import the CDBListGroupItem for the list group's items.

js
import { CDBListGroup, CDBListGroupItem } from "cdbreact";

Default ListGroup

  • List Group
  • List Group
  • List Group
  • List Group
  • List Group
js
import React from "react";
import { CDBListGroup, CDBListGroupItem, CDBContainer } from "cdbreact";
const LIstGroup = () => {
return (
<CDBContainer>
<CDBListGroup style={{ width: "30rem" }}>
<CDBListGroupItem>List Group </CDBListGroupItem>
<CDBListGroupItem>List Group</CDBListGroupItem>
<CDBListGroupItem>List Group</CDBListGroupItem>
<CDBListGroupItem>List Group</CDBListGroupItem>
<CDBListGroupItem>List Group</CDBListGroupItem>
<CDBListGroupItem>List Group</CDBListGroupItem>
</CDBListGroup>
</CDBContainer>
);
};
export default LIstGroup;

The href attribute on the CDBLIstGroupItem makes the list group item behave as a Link element.

  • List Group
  • List Group
  • List Group
  • List Group
  • List Group Link
  • List Group
js
import React from "react";
import { CDBListGroup, CDBListGroupItem, CDBContainer } from "cdbreact";
const LIstGroup = () => {
return (
<CDBContainer>
<CDBListGroup style={{ width: "30rem" }}>
<CDBListGroupItem href="#" active>
List Group
</CDBListGroupItem>
<CDBListGroupItem href="#" hover>
List Group
</CDBListGroupItem>
<CDBListGroupItem href="#" hover>
List Group
</CDBListGroupItem>
<CDBListGroupItem href="#" hover>
List Group
</CDBListGroupItem>
<CDBListGroupItem href="#" hover>
List Group Link
</CDBListGroupItem>
<CDBListGroupItem href="#" hover>
List Group
</CDBListGroupItem>
</CDBListGroup>
</CDBContainer>
);
};
export default LIstGroup;

Label

In this part of the tutorial we imported a component CDBBadge alongside CDBListGroup and the CDBLIstGroupItem.

List Group
19
List Group
19
List Group
19
List Group
19
List Group
19
List Group
19
js
import React from "react";
import { CDBListGroup, CDBListGroupItem, CDBBadge, CDBContainer } from "cdbreact";
const LIstGroup = () => {
return (
<CDBContainer>
<CDBListGroup style={{ width: "30rem" }}>
<CDBListGroupItem className="d-flex justify-content-between align-items-center">
List Group <CDBBadge color="primary">19</CDBBadge>
</CDBListGroupItem>
<CDBListGroupItem className="d-flex justify-content-between align-items-center">
List Group
<CDBBadge color="secondary">19</CDBBadge>
</CDBListGroupItem>
<CDBListGroupItem className="d-flex justify-content-between align-items-center">
List Group
<CDBBadge color="success">19</CDBBadge>
</CDBListGroupItem>
<CDBListGroupItem className="d-flex justify-content-between align-items-center">
List Group
<CDBBadge color="danger">19</CDBBadge>
</CDBListGroupItem>
<CDBListGroupItem className="d-flex justify-content-between align-items-center">
List Group<CDBBadge color="info">19</CDBBadge>
</CDBListGroupItem>
<CDBListGroupItem className="d-flex justify-content-between align-items-center">
List Group<CDBBadge color="warning">19</CDBBadge>
</CDBListGroupItem>
</CDBListGroup>
</CDBContainer>
);
};
export default LIstGroup;

Color List Group

The background color of the CDBListGroupItem is influenced by the color prop.

  • List Group
  • List Group
  • List Group
  • List Group
  • List Group Link
  • List Group
js
import React from "react";
import { CDBListGroup, CDBListGroupItem, CDBContainer } from "cdbreact";
const LIstGroup = () => {
return (
<CDBContainer>
<CDBListGroup style={{ width: "30rem" }}>
<CDBListGroupItem color="primary">List Group </CDBListGroupItem>
<CDBListGroupItem color="secondary">List Group</CDBListGroupItem>
<CDBListGroupItem color="success">List Group</CDBListGroupItem>
<CDBListGroupItem color="danger">List Group</CDBListGroupItem>
<CDBListGroupItem color="info">List Group Link</CDBListGroupItem>
<CDBListGroupItem color="warning">List Group</CDBListGroupItem>
</CDBListGroup>
</CDBContainer>
);
};
export default LIstGroup;

Icons

Pro Component

You can have icons in your list group items by nesting a CDBIcon component in a CDBLIstGroupItem. However, only pro users have access to this feature.

List Group
List Group
List Group
List Group
List Group
List Group
js
import React from "react";
import { CDBListGroup, CDBListGroupItem, CDBIcon, CDBContainer } from "cdbreact";
const LIstGroup = () => {
return (
<CDBContainer>
<CDBListGroup style={{ width: "30rem" }}>
<CDBListGroupItem>
<CDBIcon fab icon="facebook" className="mr-3" />
List Group
</CDBListGroupItem>
<CDBListGroupItem>
<CDBIcon fab icon="facebook" size="2x" className="mr-3" />
List Group
</CDBListGroupItem>
<CDBListGroupItem>
<CDBIcon fab icon="facebook" size="2x" className="mr-3" />
List Group
</CDBListGroupItem>
<CDBListGroupItem>
<CDBIcon fab icon="facebook" size="2x" className="mr-3" />
List Group
</CDBListGroupItem>
<CDBListGroupItem>
<CDBIcon fab icon="facebook" size="2x" className="mr-3" />
List Group
</CDBListGroupItem>
<CDBListGroupItem>
<CDBIcon fab icon="facebook" size="2x" className="mr-3" />
List Group
</CDBListGroupItem>
</CDBListGroup>
</CDBContainer>
);
};
export default LIstGroup;

API

This section will explain the props available with the Contrast React Bootstrap 5 ListGroup component. You will discover what these props do, their default values, and how you would use them in your code.

API Reference: Contrast React Bootstrap 5 ListGroup Props

Other CDBListGroup component prop options are listed in the table below.

NameTypeDefaultDescriptionExample
classNameStringAdds custom classes<CDBLIstGroup className="myClass" ... />
tagfunction or StringulChanges default input tag<CDBLIstGroup tag="ul" ... />

API Reference: Contrast React Bootstrap 5 LIstGroupItem Properties

Other prop options for the CDBListGroupItem component are listed in the table below.

NameTypeDefaultDescriptionExample
classNameStringAdds custom classes<CDBLIstGroupItem className="myClass" ... />
tagfunction or StringliChanges default input tag<CDBLIstGroupItem tag="li" ... />
activeBooleanfalseAdds default active state to item<CDBLIstGroupItem active .../>
colorStringChanges Item background and text color, accepts ["primary", "default", "secondary", "success", "dark", "danger", "info", "warning", "white" ]<CDBLIstGroupItem color="primary" ... />
disableBooleanfalseDisables item from being clicked<CDBLIstGroupItem disabled .../>
hoverBooleanfalseAdds hover effect (slightly background color change)<CDBLIstGroupItem hover .../>

Trying to build out all user interfaces and components for your website or web app from scratch can become a very tedious task. A huge reason why we created Contrast Bootstrap to help reduce the amount of time we spend doing that, so we can focus on building some other aspects of the project. Contrast Bootstrap PRO consists of a UI Kit featuring over 10000+ component variants. Together with a template of 5 admin dashboards and 23+ additional multipurpose pages template for building almost any type of website or web app. You can view a demo and learn more about Contrast by clicking here.Download the free react template

ad-banner

Contrast Bootstrap PRO was built using the most popular CSS framework Bootstrap to help build your next landing, admin SAAS, prelaunch etc project with a clean, prebuilt and well documented template and UI components.Learn more about Contrast