# 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.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/components/approval-panel/

*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.*

A live screen, rendered from the kit's components on the page: https://meadowstack.com/components/approval-panel/

## 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](https://meadowstack.com/examples/construction-site-management/), 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](https://meadowstack.com/patterns/approval-flow/); a leave queue built around it is the [time-off approval screen](https://meadowstack.com/screens/time-off-approval/).

## 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](https://meadowstack.com/components/audit-timeline/) (`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](https://meadowstack.com/guides/agents-md-for-react-business-apps/) explains how the rules reach them.

## How to use it

| Prop | What it takes |
| --- | --- |
| `canDecide` | Whether this person may decide this record: `can("request.approve", request)`, with the four-eyes rule inside the permission. |
| `decidedBy` | The sentence for everyone else, shown after the waiting line: who decides, and why not you when the record is yours. |
| `onApprove` | Runs after the confirm. |
| `onReject` | Gets the written reason. |
| `copy` | The card's words: `title`, `waiting`, `waitingFor`, `approve`, `reject`, `approveConfirmTitle`, `approveConfirmDescription`, `rejectConfirmTitle`, `rejectReasonLabel`, `rejectReasonPlaceholder`. |
| `children` | The slot under the title: the amount, the days, what approving changes. |

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.*

| Manifest field | ApprovalPanel |
| --- | --- |
| What it is | The decision card at the top of a record's side column: approve, or reject with a reason; nobody approves their own record. |
| Use it for | A record that needs someone else's sign-off. |
| Not for | As a coloured banner across the page |
| It replaces | Hand-built approve and reject buttons with a reason dialog |
| Screen types | Record; Index; Worklist |
| Import | `import { ApprovalPanel, approvalCopyCs } from "@meadowstack-studio/kit";` |

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.*

| Example app | Modules that render it |
| --- | --- |
| [An app for a packaging and print company](https://meadowstack.com/examples/packaging-print-production/) | Jobs, Print file editor, Quotes |
| [An app for a studio or agency](https://meadowstack.com/examples/agency-capacity-planning/) | Capacity |
| [An app for a sports club](https://meadowstack.com/examples/sports-club-court-bookings/) | Coaching |
| [An app for a construction company](https://meadowstack.com/examples/construction-site-management/) | Crews, Drawings |
| [An app for an accounting office](https://meadowstack.com/examples/accounting-office-documents/) | Invoicing |
| [An app for restaurants and venues](https://meadowstack.com/examples/restaurant-staff-rota/) | Shifts, People |

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

*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.*

From `templates/starter/src/modules/requests/components/request-record.tsx` in the Meadowstack repository:

```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>
```

## 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.

## Related

- [A driver record that says what expires next](https://meadowstack.com/screens/driver-record/) (Screens)
- [A lot record that traces one step back and one step forward](https://meadowstack.com/screens/lot-traceability/) (Screens)
- [A proof the customer approves in their own portal](https://meadowstack.com/screens/proof-approval/) (Screens)
- [A site diary day, prefilled and signed by the right person](https://meadowstack.com/screens/site-diary/) (Screens)
- [A time-off request waiting for a decision](https://meadowstack.com/screens/time-off-approval/) (Screens)
- [The approval flow](https://meadowstack.com/patterns/approval-flow/) (Patterns)
