React List Group - Flowbite

Get started with the list group component to show a list of elements and menu items inside of an unordered list item built with React and Tailwind CSS

The list group component can be used to show a list of items inside of an unordered list for website navigation, show a list of items inside of a card, and more.

You can choose from one of the examples below based on various styles and options and you can customize the component with React props and the classes from Tailwind CSS.

Start using the list group component by first importing it from Flowbite React:

'use client';

import { ListGroup } from 'flowbite-react';

Default list group

Use the default example to create a simple list of items inside of a menu by using the ListGroup component with ListGroup.Item child components inside of it.

Edit on GitHub
  • React TypeScript
'use client';

import { ListGroup } from 'flowbite-react';

export default function DefaultListGroup() {
  return (
    <ListGroup>
      <ListGroup.Item>
        Profile
      </ListGroup.Item>
      <ListGroup.Item>
        Settings
      </ListGroup.Item>
      <ListGroup.Item>
        Messages
      </ListGroup.Item>
      <ListGroup.Item>
        Download
      </ListGroup.Item>
    </ListGroup>
  )
}


Convert the list items into links by adding the href prop to the ListGroup.Item component.

Edit on GitHub
  • React TypeScript
'use client';

import { ListGroup } from 'flowbite-react';

export default function ListGroupWithLinks() {
  return (
    <ListGroup>
      <ListGroup.Item
        active
        href="/list-group"
      >
        <p>
          Profile
        </p>
      </ListGroup.Item>
      <ListGroup.Item href="/list-group">
        Settings
      </ListGroup.Item>
      <ListGroup.Item href="/list-group">
        Messages
      </ListGroup.Item>
      <ListGroup.Item href="/list-group">
        Download
      </ListGroup.Item>
    </ListGroup>
  )
}


List group with buttons

To create custom actions inside of the list group, use the onClick prop on the ListGroup.Item component.

Edit on GitHub
  • React TypeScript
'use client';

import { ListGroup } from 'flowbite-react';

export default function ListGroupWithButtons() {
  return (
    <ListGroup>
      <ListGroup.Item
        active
        onClick={()=>alert("Profile clicked!")}
      >
        <p>
          Profile
        </p>
      </ListGroup.Item>
      <ListGroup.Item>
        Settings
      </ListGroup.Item>
      <ListGroup.Item>
        Messages
      </ListGroup.Item>
      <ListGroup.Item>
        Download
      </ListGroup.Item>
    </ListGroup>
  )
}


List group with icons

Add icons to the list group items by using the icon prop on the ListGroup.Item component.

Edit on GitHub
  • React TypeScript
'use client';

import { ListGroup } from 'flowbite-react';
import { HiCloudDownload, HiInbox, HiOutlineAdjustments } from 'react-icons/hi';

export default function ListGroupWithIcons() {
  return (
    <ListGroup>
      <ListGroup.Item
        active
        icon={HiUserCircle}
      >
        <p>
          Profile
        </p>
      </ListGroup.Item>
      <ListGroup.Item icon={HiOutlineAdjustments}>
        Settings
      </ListGroup.Item>
      <ListGroup.Item icon={HiInbox}>
        Messages
      </ListGroup.Item>
      <ListGroup.Item icon={HiCloudDownload}>
        Download
      </ListGroup.Item>
    </ListGroup>
  )
}


References