Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Master Detail

ProNew

A list beside the thing chosen from it. Side by side when its container is wide; one pane at a time with a back button when it is narrow.

Installation

pnpm dlx shadcn@latest add @viewport/master-detail

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
list*React.ReactNode

The list of things to choose from.

—
detail*React.ReactNode

The chosen thing, or a placeholder when nothing is chosen.

—
open*boolean

Whether something is chosen. On narrow containers this decides which of the two panes is shown.

—
onBack*() => void

Returns to the list on narrow containers. Clear the selection here.

—
backLabelstring

The back button's text, e.g. the list's name.

"Back"
listLabelstring

Names the two regions for assistive technology.

"List"
detailLabelstring"Details"

Accessibility

  • Two labelled regions.
  • The split follows the component's own width, so it works inside panels.
  • The back button appears only when one pane is shown.
  • Respects prefers-reduced-motion.