Skip to content

Components

ApprovalPanel: the decision card on a record

ApprovalPanel is the card at the top of a record's side column where someone else signs the record off: approve after a confirm, or reject with a written reason. The person who filed the record sees who decides instead of the buttons, because nobody approves their own record.

By Bohuslav PoláčekChecked

Peter Zane's leave request in the demo's crews module, 14 to 18 December: left as Robert Brooks, managing director, sees it; right as Joe Vaughan, the foreman who filed it. The confirm and the reason dialog open on click and are not drawn here.

What it is for

A record that needs someone else's sign-off gets one card at the top of its side column: what is being decided, the figure that matters (an amount, a number of days) and two buttons. On a phone the same card comes first, above the record's details, because the decision is what the person came for.

The preview shows one record, Peter Zane's holiday in the Stonebridge example, as the two people who meet it. Robert Brooks may decide, so he sees Reject and Approve. Joe Vaughan filed the request for his crew, so he sees who decides instead: the kit puts the app's sentence in place of the buttons. Under the title, the card's slot holds what the demo puts there: five working days, the dates, and what approving changes in the crew plan.

The card shows only the waiting state. Once someone decides, the record's status and its history carry the outcome, and the app stops rendering the card, as the starter does for any request that is not submitted. The whole flow, from draft to decision, is the approval flow pattern; a leave queue built around it is the time-off approval screen.

The rules and where they live

  • A decision is a card at the top of the side column, never a coloured banner. The root AGENTS.md (Look and feel), the manifest's not, and docs/patterns.md under Lists, boards and records.
  • Four-eyes: nobody approves their own record. AGENTS.md (Permissions and audit). The skill kit-approval puts the check in the module's domain/permissions.ts, never in the page, and the api refuses the same approval.
  • Rejecting always needs a reason. AGENTS.md; the card's reject dialog will not go on without it, and kit-approval asks the api to refuse an empty reason too.
  • Every decision writes a history entry with the person and the time, and a rejection keeps its reason as the entry's detail, shown by AuditTimeline (kit-approval).
  • Hide what the person cannot do. AGENTS.md: the card takes canDecide from can(action, record) and never compares roles itself.
  • The decision card's action is ink, like a form's submit (AGENTS.md, decision 0009), and on a phone the card comes first (AGENTS.md, Responsive).
  • Checked. The entity's contract.ts sets approval: true; the card marks its buttons with entityAction("approve") and entityAction("reject"), and e2e/contracts.spec.ts approves and rejects through them on every entity that says so. The tests kit-approval asks for: the approver approves and the history shows the label with the approver's name, a rejection without a reason is refused, and the author never sees the approve button.

What AI coding tools write instead

The manifest names it: hand-built approve and reject buttons with a reason dialog. A tool asked for "an approval screen" usually puts two coloured buttons in the page header or a yellow banner across the page, and checks something like user.role === "manager" in the component. Then the person who filed the request is often a manager too and approves it themselves, the reject button sends without a reason, nothing asks before an approval that cannot be undone, and no history entry is written, because the page changed a status field and nothing else.

Meadowstack closes those gaps in the component and around it. ApprovalPanel cannot be rendered without canDecide and decidedBy, so the question of who may decide is asked on every record; reject cannot finish without a reason; and the manifest's replaces line is what an AI coding tool reads when it asks the kit's MCP server for an approval component. The guide for AI coding tools explains how the rules reach them.

How to use it

Render it only while the record waits, first in the record's properties column (Screen archetype="record") so it stays first on a phone.

Its entry in the manifest

The component's rules as the kit's manifest states them, the same entry an AI coding tool reads.Read from the kit's component manifest when the site was built (126 components, packages/kit/src/components.json); the same entry answers an AI coding tool through the kit's MCP server.

Where the example apps use it

The example apps and modules that render ApprovalPanel, read from the demo's code when the site builds.Read from the demo's source when the site was built: 6 of 9 example apps render <ApprovalPanel>, in the modules named here as each app's sidebar names them.

How the starter calls it

templates/starter/src/modules/requests/components/request-record.tsx
const mine = request.requesterId === person.id;
const canSubmit = can("request.submit", request);

// The step this person can take now, first in the side column.
const decision =
  request.status === "submitted" ? (
    <ApprovalPanel
      canDecide={can("request.approve", request)}
      decidedBy={
        mine ? "You can't approve your own request. An approver or admin decides." : "An approver or admin decides."
      }
      onApprove={() => move("approve")}
      onReject={(reason) => move("reject", reason)}
      copy={approvalCopy}
    >
      <p className="text-xl font-semibold text-fg tabular">{formatMoney(request.amount)}</p>
      <p className="text-xs text-fg-muted">
        incl. VAT, needed by <span className="tabular">{formatDate(request.neededBy)}</span>
      </p>
    </ApprovalPanel>
The starter's purchase request: canDecide comes from the permission request.approve, the sentence from whether the request is yours, and the amount sits in the card's slot.

Questions

Can someone approve their own request?

No. The four-eyes rule lives in the app's permissions, not in the page: for the person who filed the record the approve permission is false, so the card shows them who decides instead of the buttons, and the api refuses the approval as well.

Does rejecting need a reason?

Yes. Reject opens a dialog whose reason field must be filled before anything happens, and the reason is stored with the history entry, so the person who filed the record reads why and can try again.

Where does the card go on a phone?

First. On a record the decision someone came for comes before the properties, so on a phone the card sits at the top of the page, above the record's details.

Why does the card have no approved or rejected state?

Because the outcome belongs to the record. The app shows the card only while the record waits; after the decision the status at the top and the history at the end say what happened and who did it.

Can a manager approve many records at once?

Not in the card, which decides one record. A queue of approvals is a worklist screen whose bulk bar approves the ticked rows and says how many it applies to, and the api checks the four-eyes rule for each record.

Two ways

Build it yourself, or have it built

  • Build it yourself

    Build your app on the framework

    Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.

    One payment, lifetime updates

    Get the framework
  • Have it built

    Have us build your app

    Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.

    After launch, Care keeps it improving, from €99 a month.

    from €1,990

    Describe your app