Skip to content

Patterns · CRM

RecordHeader

The header of a record detail page: avatar, editable title, status, key facts, actions, prev/next, state banner and tabs.

@rookcom/monarch-react/patternsPattern

Contact with facts, actions and tabs

Ada Lovelace

ActiveEnterprise
[email protected] · Head of Engineering, Northfield
Owner
Grace Hopper
Lifecycle
Customer
Contact ID
c_1042
Phone
Not set

Usage examples

Ticket with editable subject and prev/next

Record state banner

Purpose

Heads the detail page of one record (a contact, a ticket, a project): a back link and previous/next navigation, an avatar or icon, the title (editable in place), status and badges, a subtitle, key facts, record actions, a state banner (archived, merged) and section tabs. The product supplies all data and callbacks.

Use when

  • The detail page or detail pane of one record.
  • People move through a list record by record (prev/next with a position).
  • The record’s name can be renamed in place.

Avoid when

  • A page that is not about one record (a list, settings, a dashboard): use PageHeader.
  • Facts that are the main content of the page: use a DescriptionList in the body.

Design principles

  • Identity first: avatar, name and status read as one block.
  • Key facts only: three to six facts that orient, not the whole record.
  • State is visible: archived, merged or deleted records say so in the banner, under the identity.
  • No business logic: the product decides which actions, facts and neighbours exist.

API reference

import { RecordHeader } from '@rookcom/monarch-react/patterns';
ExportKindRenderingRoot class
RecordHeadercomponentserver-safe.mn-record-header

Renders a <header>, forwards its ref and passes native attributes through.

With onTitleSave and a string title, the title is an InlineEditText inside a role="heading" element (a block editor may not sit in an <h1>). titleEditProps passes validate, maxLength and the rest through.

facts render as a DescriptionList with columns="auto" (9rem minimum); copyable and empty placeholders work as there.

navigator is { position?, onPrevious?, onNext?, previousLabel?, nextLabel?, formatPosition? }; a missing handler disables its button. Keyboard shortcuts such as J/K belong to the product.

Exported from @rookcom/monarch-react/patterns.

Generated from the TypeScript declarations of packages/react/src/patterns/crm/record-header.

Properties

RecordHeader

The header of a record detail page: back link and prev/next navigation, avatar, title (optionally editable), status and badges, key facts, actions, a state banner and section tabs. The product supplies the data.

PropTypeDescription
title requiredReactNodeThe record's name: a contact, ticket subject or project name. The page heading.
actionsReactNodeRecord actions: Buttons and a DropdownMenu ("More actions for Ada Lovelace").
avatarReactNodeAn Avatar, or an icon tile for records without a picture. Decorative unless it has its own name.
backReactNodeA BackLink or Breadcrumb above the identity block.
badgesReactNodeMore badges after the status (priority, tier, "Live chat").
bannerReactNodeA record state notice under the header content: archived, merged, deleted (an InlineNotice or Alert).
childrenReactNode
classNamestring
factsRecordHeaderFact[]Key facts under the identity block, as a compact DescriptionList.
headingLevel"h2" | "h1"Heading level of the title. `h1` (default) on a record page; `h2` in an inbox detail pane.
idstring
navigatorRecordHeaderNavigatorPrevious/next record buttons at the top end.
onTitleSave((next: string) => void | Promise<void>)Makes a text `title` editable in place with InlineEditText. Resolve to save; reject to keep the editor open with the error.
statusReactNodeA StatusBadge next to the title.
subtitleReactNodeA line under the title: the record number, email, "Opened 3 days ago by Ada".
tabsReactNodeA TabsList or TabsNav for the record's sections.
titleEditPropsPartial<Omit<InlineEditTextProps, "value" | "defaultValue" | "label" | "onSave">>Extra InlineEditText props for the title editor (validate, maxLength, disabled).
titleLabelstringAccessible name of the title editor. Default "Title".

Variants

PropValuesDescription
avatar / status / badges / subtitle / facts / actions / back / navigator / banner / tabs'omitted''provided'Each part renders only when provided.
headingLevel'h1''h2'h1 (default) on a record page; h2 inside an inbox detail pane under the page h1.
onTitleSave'omitted''function'Makes a text title editable in place. Exposed as data-editable.

States

StateExposed asBehaviour
Static–Without onTitleSave and navigator the header has no state of its own.
Editing title–InlineEditText states: editing, saving (spinner), error (kept open with the message).
First / last record–The previous or next button is disabled when its handler is omitted.

Interaction behaviour

  • Activating the title (when editable) opens the editor; Enter or blur saves, Escape cancels.
  • Previous and next call onPrevious and onNext; the product navigates and updates position.
  • Fact copy buttons copy their value.

Keyboard support

KeysAction
TabBack link, previous/next, title editor, actions, fact copy buttons, banner actions, tabs.
EnterOn the title, starts editing; in the editor, saves.
EscapeIn the title editor, cancels and restores the title.

Accessibility

Role
banner landmark only when it is not inside main, article or section (native <header> rules)
Accessible name
The title is the page or pane heading.
  • The title is an h1 (or h2); an editable title keeps the heading role and level.
  • Previous/next are icon buttons with required names; name the record type ("Next ticket").
  • Put role="status" content in banner (InlineNotice) so state changes are announced.
  • Give an actions menu a specific name: "More actions for Ada Lovelace".
  • The live examples on this page render with headingLevel="h2" because the docs page has its own h1; in an app use the default h1.

Responsive behaviour

  • The identity block and the actions wrap; actions take the full width under 480px.
  • Facts fill as many 9rem columns as fit and become one column at 640px and below.
  • Long titles wrap anywhere; the title steps down a size under 480px.
  • Actions, navigator and tabs are hidden when printing.

Theme support

  • Text, borders and dividers use Monarch semantic tokens, so every theme applies.

Do and don't

Do

  • Keep facts to the few that orient someone on arrival.
  • Name previous/next after the record type.
  • Show archived, merged and deleted states in banner.

Don't

  • Do not put a second h1 on a page that has a RecordHeader.
  • Do not make a rich (non-text) title editable; onTitleSave needs a string title.
  • Do not repeat every field of the record in facts.

Dependencies

KindDepends on
npm packagesreact
Monarch componentsButton, DescriptionList, InlineEditText

Testing coverage

  • Renders back link, avatar, title (h1), status and badges, subtitle, facts (dl with copy and placeholder), actions, banner and tabs; ref forwarding.
  • Prev/next: position text, custom labels, disabled first record, keyboard activation.
  • Custom position format; no position for an empty list.
  • Editable title keeps the heading role; Enter saves, Escape cancels; extra editor props apply.
  • A non-text title stays a plain heading.
  • Renders on the server.
CheckCovered
Axe in jsdomYes
Server renderingYes
Browser suitesVisual baselines: /__gallery/record-header; Cross-browser axe: /components/record-header

Tests: packages/react/src/patterns/crm/record-header