Back to elements
ElementData DisplayFree

List Group React component

A framed group of rows for settings menus and navigation lists: icons, descriptions, count badges, a danger row for destructive actions, and in selectable mode an active highlight that slides from row to row with arrow-key navigation.

When to use the List Group component

Use List Group for settings menus, account pages, sidebars inside panels and short lists of actions or links. Each row can carry an icon, a hint and a count, and the danger tone keeps destructive actions visibly apart.

Use single selection when the list switches what's shown next to it (like settings sections); use none when rows are links or one-off actions.

Installation

Add the List Group component to your project with the shadcn CLI. It lands in components/list-group.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add https://reactframe.com/r/list-group.json

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

Props

<ListGroup /> accepts 11 props, all optional.

  • items
    ListGroupItem[]
    Default: DEFAULT_ITEMS
  • selectable

    single: one item is active and the highlight slides to it. none: plain actions or links.

    "single" | "none"
    Default: "single"
  • value
    string
  • defaultValue
    string
    Default: "profile"
  • onValueChange
    (id: string) => void
  • onItemClick

    Called for every activation (click, Enter), selectable or not.

    (item: ListGroupItem) => void
  • variant

    bordered: framed with dividers. inset: framed, rows as separate pills. flush: no frame.

    "bordered" | "inset" | "flush"
    Default: "bordered"
  • showChevron
    boolean
    Default: true
  • label
    string
    Default: "Settings"
  • theme
    "dark" | "light"
    Default: "dark"
  • className
    string

FAQ

What does the selectable mode add?
One row stays active, the highlight slides to the one you pick, and the list becomes a listbox: arrow keys, Home and End move between rows and skip disabled ones.
Can rows be links?
Yes. Give a row an href and it renders as a link; in single mode the active link gets aria-current="page".
Which style should I use?
Bordered for a classic settings list with dividers, inset when rows should read as separate pills inside a card, flush when the list sits inside something that already has a frame.

Related components

Basic Table
Free
Chat Bubble
Free
Blockquote
Free
Tree Table
Free
Transfer List
Free
Variant Swatches
Free