Component · server or client
Audit Timeline
The history panel every back-office record needs. Events are grouped by day in the reader's time zone, and each edit is shown as a before and after that a screen reader announces as such.
Try it
Tuesday, March 3, 2026
Daniel Okafor (Approver) Approved and released
- Status
from Pending approvalto Released
Mina Rahimi (Payments clerk) Updated the payment
- Reference
from March suppliesto INV-4471- Status
from Changes requestedto Pending approval- Value date
from 2026-03-04to 2026-03-05
Show 3 more changesShow fewer changes
- Charges
from OURto SHA- Purpose code
- to SUPP
- Priority
from Normalto Urgent
Monday, March 2, 2026
Daniel Okafor (Approver) Sent back for changes
The reference should match the invoice number.- Status
from Pending approvalto Changes requested
Mina Rahimi (Payments clerk) Edited the amount
Invoice 4471 had a credit note attached.- Amount
from €18,250.00to €17,890.40
Mina Rahimi (Payments clerk) Created the payment
- Beneficiary
- to Northwind Supplies GmbH
- Amount
- to €18,250.00
Switch to Tokyo: the 23:41 rejection moves to the next day, because day headings follow the reader, not the server.
Install
npx shadcn@latest add https://tellerline-ui.vercel.app/r/audit-timeline.jsonIt has no client-side JavaScript of its own, so it renders in a Server Component.
Usage
import { AuditTimeline, type AuditEvent } from "@/components/ui/audit-timeline"
import { formatMoney } from "@/lib/money"
const events: AuditEvent[] = [
{
id: "evt_102",
at: "2026-03-02T09:02:00Z",
actor: { name: "Mina Rahimi", role: "Payments clerk" },
action: "Edited the amount",
tone: "warning",
changes: [{ field: "amount", label: "Amount", from: "18250.00", to: "17890.40" }],
},
]
export function PaymentHistory({ timeZone }: { timeZone: string }) {
return (
<AuditTimeline
events={events}
timeZone={timeZone}
formatValue={(field, value) =>
field === "amount" ? formatMoney(String(value), { currency: "EUR" }) : String(value)
}
/>
)
}Behaviour
- Time zones
- Pass the reader's IANA time zone. Days are split in that zone and every time is a <time> element with the exact instant in dateTime and title.
- Relative time
- “2 hours ago” only appears when you pass now. Leaving it out keeps the server and client render identical, so there is no hydration mismatch.
- Before and after
- Changes are a description list with <del> and <ins>. Visually hidden “from” and “to” words make the change clear without the arrow.
- Long edits
- Events with more changes than collapseAfter fold the rest into a native <details>, which needs no script and works with the keyboard.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| events | AuditEvent[] | — | id, at, actor, action, and optionally tone, note and changes. |
| timeZone | string | runtime zone | IANA zone used for day grouping and times. Pass it explicitly when rendering on the server, or the server and browser may split days differently. |
| locale | string | "en-US" | Locale for dates, times and relative time. |
| now | Date | — | Turns on relative times. Pass a stable value from the server. |
| order | "newest" | "oldest" | "newest" | Sort order of days and events. |
| formatValue | (field, value) => ReactNode | String | Formats change values, for amounts, dates or enums. |
| collapseAfter | number | 4 | How many changes to show before folding the rest. |
| headingLevel | 2 – 6 | 3 | Heading level of the day titles, to fit the page outline. |
| empty | ReactNode | "No activity yet." | Shown when there are no events. |