The new pricing page reads much better. Can we move the FAQ above the plans?
List Group
A card of list rows with an optional header. Plain groups show rows; selectable, toggle, expandable, sortable, tree, action, discussion and master-detail groups add behaviour.
Playground
Installation
List Group comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import {
ListGroup,
ListGroupActions,
ListGroupActionsProps,
ListGroupDetails,
ListGroupDetailsProps,
ListGroupDiscussion,
ListGroupDiscussionProps,
ListGroupExpandable,
ListGroupExpandableItem,
ListGroupExpandableProps,
ListGroupHeader,
ListGroupHeaderProps,
ListGroupMasterDetail,
ListGroupMasterDetailItem,
ListGroupMasterDetailProps,
ListGroupProps,
ListGroupSection,
ListGroupSectionProps,
ListGroupSelectable,
ListGroupSelectableItem,
ListGroupSelectableProps,
ListGroupSortable,
ListGroupSortableItem,
ListGroupSortableProps,
ListGroupToggle,
ListGroupToggleItem,
ListGroupToggleProps,
ListGroupTree,
ListGroupTreeProps,
} from "@wunderui/react"Then use it:
import { ListGroup } from "@wunderui/react"
export function Team() {
return (
<ListGroup
title="Team"
count={2}
items={[
{ id: "nora", title: "Nora Lindgren", description: "Owner" },
{ id: "daniel", title: "Daniel Okafor", description: "Engineering" },
]}
/>
)
}Expected result: You see one bordered card with the title Team and a count of 2, and two rows divided by a line.
When to use
Use List Group for
- A card of related rows with a title, a count or an action
- Settings, members, files, tickets and inboxes
- Rows that people select, switch, open, reorder, run or discuss
Use something else for
- List Panel for a dashboard card with a footer and loading, empty and error states
- List Item for a single row inside a card you build yourself
- Data Table for many rows that people sort, filter or compare by column
Header
The header holds a title, description, count badge and one action. For a group without a header, hide it and give the group an aria-label.
Density
Comfortable rows have 12 px of vertical padding, compact rows 8 px. The group passes it to every row.
Sections
A section is a labelled run of rows with an optional count. The label scrolls with the rows; there are no sticky headers.
Choose
Selectable groups put a checkbox or radio before each row, toggle groups a switch after it. The whole row takes the click and the control keeps keyboard focus.
Reveal
Expandable rows open a detail box under them, the tree nests rows by level, and master-detail shows the chosen row beside the list when there is room.
Behaviour
Sortable rows move by drag handle or with Alt and the arrow keys, and action rows run a command and show its shortcut. A discussion holds comments with reactions and replies.
Loading, empty and error
The group has no states of its own. Build them inside the card: skeleton rows while loading, an Empty State when there is nothing to show or the load failed.
Content
Keyboard interactions
A plain group has no focus handling of its own: only controls in its rows take focus. The groups with behaviour add the keys below.
- TaborShiftTab
- Moves focus to the next or previous control. A tree, an action list and a master-detail list are one stop: Tab enters them and leaves them.
- Space
- Toggles the focused checkbox or switch, and selects the focused radio. A click on the row does the same.
- EnterorSpace
- Opens or closes the focused expandable row, and presses the focused button.
- AltArrowUporAltArrowDown
- Sortable: moves the row whose handle has focus one place. Space picks the row up, the arrows move it, Space drops it and Escape puts it back.
- ArrowUporArrowDownorHomeorEnd
- Tree, action list and master-detail: move to the previous, next, first or last row. In master-detail the selection and the detail follow.
- ArrowRightorArrowLeft
- Tree: opens a closed folder or enters it, and closes an open folder or goes to its parent. Enter or Space selects the row.
- EnterorSpace
- Action list: runs the focused action. Typing a letter jumps to the next action that starts with it.
A button or link row is one tab stop. Selectable, toggle, expandable, sortable and discussion rows each have their own; tree, actions and master-detail are one stop with arrow keys inside.
Behavior and motion
What the group does with state, content, the DOM and motion.
- Controlled or not
- These groups keep their own state. Pass a value and change handler (or the items or comments equivalents) to control them, or a default value to set the first state.
- Rows and the card
- The card has 8 px padding and a 16 px radius, so the 8 px rows are concentric to it. The group passes its density and dividers to its rows, and sections wrap rows in ListGroupSection.
- No states of its own
- The group has no loading, empty or error look and no sticky headers or scroll region. Put a Skeleton, an Empty State or a message inside the card.
- Click anywhere in the row
- In selectable and toggle groups a click on the row toggles its control, unless it lands on a control, button, link or field. The control keeps focus, so the row is still one tab stop.
- Sortable announces its moves
- Every move, by pointer or keyboard, is announced politely with the new position, like Daniel Okafor moved to position 1 of 3. The row menu also offers Move up and Move down.
- Expandable keeps closed content out of reach
- A closed row's detail is inert, so its buttons leave the tab order. Opening one row closes the other unless multiple is allowed; rows are disclosure buttons with aria-expanded and aria-controls.
- Master-detail adapts
- The list is a listbox whose selection drives the detail, and the card is 880 px wide by default. Beside the 400 px list sits a detail column; under 720 px the detail stacks below the list.
- Motion and reduced motion
- Rows fill and press quickly; an expandable row animates its detail open and turns its chevron. With reduced motion the press scale is off and the detail only fades.
Anatomy
The parts of a group, numbered in the figure. The groups with behaviour (selectable, toggle, expandable, sortable, tree, actions, discussion, master-detail) are made of the same parts.
Inbox
Two new messages
- Nora LindgrenCommented on Launch plan2m ago
- Daniel OkaforReplied in Docs rewrite1h ago
- data-slot="list-group"
The card: a section 400 px wide (it shrinks on a narrow screen) with a 1 px border, 16 px radius, card surface and 8 px padding. A title names the section.
- data-slot="list-group-header"
The header row, with 12 px padding and 12 px between its parts. It shows when a title is set or the header is turned on.
The title as a heading (h3 by default) in 14 px semibold, with an optional 12 px secondary description under it.
The count in a grey pill badge after the title, in tabular figures.
The action at the right of the header: any element, usually a link Button such as View all.
- data-slot="list-group-section"
A labelled run of rows. The label is 12 px semibold tertiary text with an optional count badge, and it doesn't stick to the top while the rows scroll.
The rows, from the items list or as ListItem children. The group tells them its density and whether they have dividers.
- data-slot="list-group-details"
- data-slot="list-group-master-detail"
Best practices
- Do
Pick the group that matches the job: Selectable for choosing, Toggle for switching, Expandable for details, Sortable for order. Behaviour, focus handling and labels come with it.
- Do
Give every group a name: a title, or an aria-label when the header is hidden.
- Do
Use sections when the rows fall into a few labelled runs, such as Today and Yesterday, and keep the labels short.
- Do
Build the loading, empty and error looks inside the card with Skeleton and Empty State, so the card does not jump away.
- Don’t
Don't expect sticky section labels or a scroll region. The group grows with its rows; for a fixed height put it in a container that scrolls.
- Don’t
Don't mix behaviours in one group, for example a toggle row between selectable rows. Use two groups with their own titles.
- Don’t
Don't nest a List Group in another card with a border. The group is already a card.
API reference
Every group takes the props of ListGroup and every attribute of a section; the groups with behaviour add the props listed under their name. Rows are ListItemData (see List Item).
The card: a section 400 px wide (it shrinks on a narrow screen) with a 1 px border, 16 px radius, card surface and 8 px padding. A title names the section.
The header row, with 12 px padding and 12 px between its parts. It shows when a title is set or the header is turned on.
A labelled run of rows. The label is 12 px semibold tertiary text with an optional count badge, and it doesn't stick to the top while the rows scroll.
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("list-group")The full library index for assistants is at /llms.txt.