Skip to content

List-detail layout

Pro

M3's list-detail canonical layout, sized by its own width: one pane at a time below 840px, the list beside the open item from 840px. For settings, an inbox or a dashboard. Not an M3 component (@windmorph/react-pro).

import { ListDetailLayout } from '@windmorph/react-pro';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Purpose

The list-detail layout shows a list of items and the one that's open. When the layout is narrower than 840px, one pane shows at a time: the list, or the open item with a way back. From 840px wide the list sits beside the open item, so people can move between items without losing their place. It is not an M3 component: M3 defines list-detail as a canonical layout, and this one comes from @windmorph/react-pro, built from M3's window size class thresholds, pane widths and spacer, colour roles, shapes and the shared axis transition.

Use Tabs for a few peer views of the same thing, and a Dialog for a short task that doesn't need its own URL.

Panes and widths

  • Its own width decides: the thresholds are M3's window size classes, measured on the width the layout's wrapper gives it (a CSS container query), not the window's. In a side panel, a dialog or a page column narrower than 840px it shows one pane on any screen, and the server still renders the right layout. In a parent that sizes to its content (an inline block, a dialog's panel) it takes the list's width rather than collapsing.
  • Compact and medium (below 840px): one pane, chosen by active. The back slot shows at the top of the open item.
  • Expanded and wider (840px and up): both panes, a fixed list (360px, 412px from 1200px, or listWidth) beside a flexible detail, with M3's 24px spacer. The list is sticky; set stickyTop to stop it below a sticky top app bar. Inside a container that scrolls by itself and is shorter than the window (an app frame's pane, a dialog), set --wm-list-detail-layout-available-height to the container's height, so the list ends at its edge.
  • URL-driven: in an app, make the list items links (href) and pass active from the route: "list" on the list's route, "detail" on an item's. The panes switch with CSS, so a server-rendered page never jumps. Render it in a shared route layout so it stays mounted between items.
  • With one pane, they switch with M3's shared axis transition both ways: the outgoing pane fades and slides out before it hides, and the incoming one fades and slides in. Focus moves to the new pane without scrolling the page.
  • The page keeps its heading: with one pane, the list and its heading are gone while an item is open. pageHeading says the page's heading again, first in the detail pane, for assistive technology only (visually hidden), so the page always has its heading. It is usually the list's own heading's words, at pageHeadingLevel (1 by default). From 840px, with the list beside it, it isn't there for anyone. It switches in CSS, so the server's HTML is right.
  • variant: plain (the default) puts the panes on the page's surface; filled makes each a surface-container-low container with large corners.

When not to use

For a few peer views use Tabs; for a short task that doesn't need its own URL, a Dialog.

See also

  • List: Rows with headline, overline, supporting text and leading or trailing content (icons, avatars, images, video thumbnails); items can be links, switches, checkboxes or radio buttons, and put in order by drag or a menu.
  • Navigation rail: Top-level destinations along the start edge, collapsed or expanded, in medium windows.
  • Sheets: Bottom and side sheets for supplementary content, modal or standing in the layout.