Genesis
@beta

ResourceDetailPage

ResourceDetailPage — `DetailPage` with a record bound to it: fetches one record by id through the mounted `DataProvider` and hands it to the title, the actions, the sidebar and the content. ```tsx <ResourceDetailPage resource="people" id={params.id} subtitleField="role" actions={(person) => <Button testID="edit">Edit {person.name}</Button>} sidebar={(person) => <StatCard label="Sessions" value={person.session_count} />} > {(person) => <Section title="Timeline"><Timeline personId={person.id} /></Section>} </ResourceDetailPage> ``` This is the detail-route counterpart to `ResourcePage`, which is the list one. Both are **data-bound**, not layouts: they need a resource contract to be useful, which is the layers table's admission test for this tier. The structure they render is a layout and lives one layer down — `DetailPage` in `@marktiderman/genesis-ui/layout` — so an app with its own fetching keeps the page shape without inheriting the provider. That layout/data-bound pairing is the same one `AppShell` and `ResourcePage` already have. The three non-record states are rendered here rather than left to the caller, because a per-app "loading…" is exactly the hand-written code a template exists to remove: - loading, or no id yet -> `PageLoading` - absent -> `EmptyState` saying so, distinct from the error state, since a deleted record and a broken query need different words. Every provider Genesis ships signals "no such row" by throwing rather than by resolving empty, so this state is reached by classifying the error (see `isNotFoundError`) as well as by a falsy `data` - any other failure -> `EmptyState` carrying the provider's message, which is kept verbatim: an error state that hides what went wrong is the one nobody can act on `titleField` is exact: name a field and you get that field, empty string included. The `name` -> `title` -> id chain is the DEFAULT, not a fallback layered under an explicit choice — a page silently titled by a different column than the one asked for is worse than a blank one.

packages/ui/src/components/data/ResourceDetailPage.tsx

Import
Subpath export: @marktiderman/genesis-ui/data
import { ResourceDetailPage } from "@marktiderman/genesis-ui/data";
Components
Auto-generated from TypeScript source via react-docgen-typescript.

ResourceDetailPage

ResourceDetailPage — `DetailPage` with a record bound to it: fetches one record by id through the mounted `DataProvider` and hands it to the title, the actions, the sidebar and the content. ```tsx <ResourceDetailPage resource="people" id={params.id} subtitleField="role" actions={(person) => <Button testID="edit">Edit {person.name}</Button>} sidebar={(person) => <StatCard label="Sessions" value={person.session_count} />} > {(person) => <Section title="Timeline"><Timeline personId={person.id} /></Section>} </ResourceDetailPage> ``` This is the detail-route counterpart to `ResourcePage`, which is the list one. Both are **data-bound**, not layouts: they need a resource contract to be useful, which is the layers table's admission test for this tier. The structure they render is a layout and lives one layer down — `DetailPage` in `@marktiderman/genesis-ui/layout` — so an app with its own fetching keeps the page shape without inheriting the provider. That layout/data-bound pairing is the same one `AppShell` and `ResourcePage` already have. The three non-record states are rendered here rather than left to the caller, because a per-app "loading…" is exactly the hand-written code a template exists to remove: - loading, or no id yet -> `PageLoading` - absent -> `EmptyState` saying so, distinct from the error state, since a deleted record and a broken query need different words. Every provider Genesis ships signals "no such row" by throwing rather than by resolving empty, so this state is reached by classifying the error (see `isNotFoundError`) as well as by a falsy `data` - any other failure -> `EmptyState` carrying the provider's message, which is kept verbatim: an error state that hides what went wrong is the one nobody can act on `titleField` is exact: name a field and you get that field, empty string included. The `name` -> `title` -> id chain is the DEFAULT, not a fallback layered under an explicit choice — a page silently titled by a different column than the one asked for is worse than a blank one.

PropTypeDefaultDescription
children*(record: T) => ReactNode—The primary content region.
id*Identifier | null | undefined—Record id. Nullish means "not resolved yet" — no request goes out and the page shows its loading state, which is what a route param that hasn't arrived should look like. It is deliberately NOT the not-found state: nothing has been asked, so nothing is missing.
resource*string—Resource name, resolved through the mounted `DataProvider`.
actions((record: T) => ReactNode)—Record-scoped controls, built from the loaded record.
breadcrumbReactNode—Slot above the title: a `Breadcrumb`, a back link, a `StatusBadge`.
classNamestring—
selectstring—Provider select/join syntax, e.g. `"*, owner:profiles(name)"`.
sidebar((record: T) => ReactNode)—Metadata column, built from the loaded record.
subtitleFieldstring—Field used as the line under the title.
testIDstring—Stable test/automation selector (emitted as `data-testid`).
titleFieldstring—Field used as the page title. Defaults to `name`, then `title`, then the id — the same fallback chain `ResourcePage` uses for a row's label.