Skip to content
English
List-detail morph comes with Pro. Its preview shows once you unlock it.

How it works

One card with a warm paper tint mixed from the tokens. The list and the detail share one box of fixed height. Opening a note is derived during render: the positions on screen are read before React commits, and in the first frame the detail heading is played from the row title's rectangle (translate plus a scale of the font-size ratio, transform only) to its own place. The header lifts away, the other rows drift down and fade, nearest first, and the back chevron, date and body fade up in turn. Back runs the same flight the other way into the row while the rows return one after another. The + button grows a menu from its own corner; a chosen kind inserts a row at the top that opens from a squashed, transparent state while the rows below slide down from where they were, and the count rolls up.

Use it for

  • A compact widget or side panel where a list item opens into its detail without leaving the card: notes, messages, saved items.
  • Mobile screens where the shared title keeps the reader oriented between list and detail.

Look elsewhere when

  • Details that need a full page, editing tools or their own address: navigate to a page instead.
  • Long lists that need search and filters: use a full list view.

Usage

import { ListDetailMorph } from './ListDetailMorph.jsx'

const notes = [
  { id: 'a', title: 'Weekend market list', meta: 'Today · Figs, sourdough', date: 'Today, 9:41', body: 'Figs, a sourdough loaf and two lemons.' },
  { id: 'b', title: 'Ideas for the garden', meta: 'Today · Raised bed', date: 'Today, 8:15', body: 'A raised bed by the fence for herbs.' },
  { id: 'c', title: 'Bike repair', meta: 'Monday · Brake pads', date: 'Monday, 18:30', body: 'Front brake pads are worn.' },
]

export function NotesCard() {
  return (
    <ListDetailMorph
      title="Notes"
      defaultItems={notes}
      onOpen={(id) => console.log('opened', id)}
      onCreate={(kind) => console.log('create', kind)}
    />
  )
}

Props

PropTypeDefaultWhat it does
items / defaultItems{ id, title, meta?, date?, body? }[]- / []The notes. A new items array from the parent replaces the list (rows that stay slide to their new places, new ones open their space); defaultItems only seeds it. meta is the row's second line, date the line under the heading (meta when missing), body the full text.
titleReactNode'Notes'The list header that lifts away when a note opens.
openId / defaultOpenId / onOpenChangeid | null / id | null / (id | null) => void- / null / -Which note is open, controlled or uncontrolled. null shows the list.
onOpen(id) => void—Called when a note is opened.
onCreate(kind: 'note' | 'checklist' | 'folder') => item | false | void—Called when a kind is chosen in the + menu. Return an item to insert it, false to insert nothing (when you add it to items yourself), or nothing to insert an untitled row.
menuOpen / onMenuOpenChangeboolean / (open) => void—Controls the + menu if you need to; it is uncontrolled otherwise.
heightnumber | string312Height of the area that holds the list and the detail, so opening a note never resizes the card. Long lists scroll inside it.
headingLevel1-52Heading level of the title; the detail heading is one level below.
labelsobject—Replaces built-in text: back, add, menu, kinds { note, checklist, folder }, count(n), untitled(kind), justNow, noText, added(title), empty. Shallow-merged over the English defaults.
...restHTMLAttributes—Other attributes go to the root <section>. Set --ds-ldm-tint in style to change the paper tint.

Accessibility

  • Rows are buttons in a list; opening one moves focus to the detail heading (tabindex -1), and Back or Escape returns focus to the row it came from.
  • While a note is open the list and footer are inert and hidden from screen readers; while it is closed the detail is.
  • The + button has aria-haspopup="menu", aria-expanded and aria-controls; the menu has role="menu" with menuitem buttons. Opening it focuses the first item (ArrowUp on the button focuses the last), ArrowUp / ArrowDown / Home / End move between items, Escape closes it and returns focus to the button, Tab or a press outside closes it.
  • A created note is announced through a polite status region, and the count uses tabular figures.
  • Focus only moves when focus was already inside the card, so a script that drives the props never steals focus from the page.
  • The + and back buttons are 40px and 36px (40px on touch screens), menu items 36px (44px on touch screens); every control shows a focus ring.
  • Reduced motion: nothing travels or scales; the list and detail, the menu and the count cross-fade in 120ms.

Motion

Title flight: transform 420ms cubic-bezier(0.3, 1.12, 0.5, 1), from the old rectangle and font-size ratio to none; interrupting reads the current position, so it turns mid-air. Header: lifts 12px and fades in 160ms. Other rows: drift 18px down and fade over 240ms with a 24ms stagger, and return over 360ms ease-out after 80ms with a 40ms stagger. Detail: back chevron at 140ms, date at 160ms, body at 220ms, each rising 8px over 360ms ease-out. Menu: scale 0.9 to 1 and fade over 180ms ease-out from the corner at the + button, closing in 140ms; the + turns 45 degrees. New row: opens from scaleY(0.4) and opacity 0 over 320ms after 60ms while the rows below slide from their old places; the count rolls by its height in 360ms.

Add it to your project

Pro members copy a prompt and their coding agent installs the source, the same way as the free components.

ListDetailMorph.jsxlist-detail-morph.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Lists & layout
Arc carousel comes with Pro. Its preview shows once you unlock it.
Cylinder carousel comes with Pro. Its preview shows once you unlock it.