Prodular UI

Master detail

A list beside the selected record. Side by side and resizable on wide screens, with empty and loading states; on phones the record takes the screen with a Back button.

npx prodular-ui add master-detail

Approvals inbox

Pick a request to load it. Drag the divider to resize. Narrow the window to see the phone view with Back.

Waiting for you5 requests
PR-1042

Lumen Cloud Services

Needs approval
Amount
$18,400
Category
Cloud infrastructure
Requested by
Theo Lindqvist
Waiting
2h

Reserved instances for Q4, 14% under on-demand pricing.

Anatomy

<MasterDetail  list={rows}  detail={selected ? <Record id={selected} /> : null}  onBack={() => setSelected(null)}  storageKey="approvals"/>

Guidance

Use it when

  • Inboxes, queues and lists where people go through records one by one: approvals, tickets, messages, leads.
  • storageKey so the list width people chose survives reloads.
  • loading while the selected record is fetched, so the pane does not flash empty.

Avoid

  • Records that need the full page to edit. Open them on their own route.
  • Comparing many columns. Use Data table or Data grid, and open the record in a Sheet.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Pass the list as rows of buttons with aria-current on the selected one, and the selected record as detail, or null when nothing is selected.
  • Set onBack to clear the selection; on phones it is the only way back to the list.
  • Give MasterDetail a height through its parent (h-full in a page, or a fixed height in a card); both panes scroll on their own.
  • Keep listHeader for the title, count, search or filters of the list.

API

MasterDetail

PropTypeDefaultDescription
list / detailReactNode / ReactNode | nullThe list and the selected record.
listHeaderReactNodeA bar over the list.
onBack / backLabel() => void / string"Back"Back to the list on phones.
emptyReactNodeShown when nothing is selected.
loadingbooleanfalseA skeleton in the detail pane.
resizable / defaultListSize / storageKeyboolean / number / stringtrue / 38The draggable divider, the list width in percent and where to remember it.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add master-detail# or, with the registry in components.jsonnpx shadcn@latest add @prodular/master-detail