Approval chain
An approval as steps: people one by one or all at once, status, due date, reminder, comments, audit.
import { ApprovalChain, ApprovalAudit, resolveChain, chainStatus, chainProgress } from "@forgeron/ui";Manager
ApprovedDue Nov 14- Léa MartinTeam lead2026-11-13 09:12 UTCApproved
- Léa Martin · 2026-11-13 09:12 UTCFine for me, receipts attached.
Finance
To actAll at onceDue Nov 18 · late- Karim AzizControllerTo act
- Jo BernardAccountingTo act
Director
Waiting- Sam RocheDirectorWaiting
History
- Léa Martin approved
- Sam submitted the expense
import { ApprovalChain, type ApprovalStep } from "@forgeron/ui";
const steps: ApprovalStep[] = [
{
id: "manager",
label: "Manager",
due: "2026-11-14",
participants: [
{
id: "lea",
name: "Léa Martin",
role: "Team lead",
status: "approved",
at: "2026-11-13T09:12:00Z",
},
],
comments: [
{
id: "c1",
author: "Léa Martin",
at: "2026-11-13T09:12:00Z",
text: "Fine for me, receipts attached.",
},
],
},
{
id: "finance",
label: "Finance",
mode: "parallel",
due: "2026-11-18",
participants: [
{ id: "karim", name: "Karim Aziz", role: "Controller", reminded: "2026-11-17" },
{ id: "jo", name: "Jo Bernard", role: "Accounting" },
],
},
{
id: "director",
label: "Director",
participants: [{ id: "sam", name: "Sam Roche", role: "Director" }],
},
];
export default function Default() {
return (
<div style={{ width: "100%", maxWidth: 640 }}>
<ApprovalChain
label="Expense 214"
value={steps}
today="2026-11-19"
onRemind={() => {}}
events={[
{
id: "e1",
at: "2026-11-12T16:40:00Z",
actor: "Sam",
action: "submitted the expense",
tone: "neutral",
},
{
id: "e2",
at: "2026-11-13T09:12:00Z",
actor: "Léa Martin",
action: "approved",
tone: "success",
},
]}
/>
</div>
);
}Review
To act- Léa MartinTeam leadTo act
- Karim AzizControllerWaiting
import { ApprovalChain, type ApprovalStep } from "@forgeron/ui";
import { useState } from "react";
const people = [
{ id: "lea", name: "Léa Martin", role: "Team lead" },
{ id: "karim", name: "Karim Aziz", role: "Controller" },
{ id: "jo", name: "Jo Bernard", role: "Accounting" },
{ id: "sam", name: "Sam Roche", role: "Director" },
];
export default function Editable() {
const [steps, setSteps] = useState<ApprovalStep[]>([
{ id: "s1", label: "Review", participants: [people[0]!, people[1]!] },
]);
return (
<div style={{ width: "100%", maxWidth: 640 }}>
<ApprovalChain
label="Approval flow"
editable
people={people}
value={steps}
onChange={setSteps}
onComment={() => {}}
/>
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Names the chain: “Expense 214”. |
value / defaultValue / onChange | { id, label?, mode?, participants, due?, comments? }[] | — | The steps. mode: sequential (default) or parallel. A participant's status is found (resolveChain) unless given. |
editable | boolean | false | Add, remove and reorder people (drag or Alt + arrows), switch a step's mode, add, move and remove steps. |
people | { id, name, role?, email? }[] | — | Who can be added; those already in the chain are left out. |
today | string | — | YYYY-MM-DD: a step past its due date is marked late. |
onRemind | (person, step) => void | — | The Remind button on whoever is current. |
onComment | (stepId, text) => void | — | A box to comment under each step (⌘ Enter sends). |
events | { id, at, actor, action, detail?, tone? }[] | — | The audit, under the chain (newest first). ApprovalAudit alone takes the same. |
stepName / stepActions / empty | string; (step, i) => ReactNode; ReactNode | — | Wording and extras. |
statusLabels | Partial<Record<ApprovalStatus, string>> | — | Other words for waiting, current, approved, rejected, skipped. |
className | string | — | Extra classes. |