Skip to content
tellerline

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

  1. Daniel Okafor (Approver) Approved and released

    Status
    from Pending approvalto Released
  2. 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 changes
    Charges
    from OURto SHA
    Purpose code
    to SUPP
    Priority
    from Normalto Urgent

Monday, March 2, 2026

  1. Daniel Okafor (Approver) Sent back for changes

    The reference should match the invoice number.
    Status
    from Pending approvalto Changes requested
  2. Mina Rahimi (Payments clerk) Edited the amount

    Invoice 4471 had a credit note attached.
    Amount
    from €18,250.00to €17,890.40
  3. 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.json

It 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

PropTypeDefaultDescription
eventsAuditEvent[]—id, at, actor, action, and optionally tone, note and changes.
timeZonestringruntime zoneIANA zone used for day grouping and times. Pass it explicitly when rendering on the server, or the server and browser may split days differently.
localestring"en-US"Locale for dates, times and relative time.
nowDate—Turns on relative times. Pass a stable value from the server.
order"newest" | "oldest""newest"Sort order of days and events.
formatValue(field, value) => ReactNodeStringFormats change values, for amounts, dates or enums.
collapseAfternumber4How many changes to show before folding the rest.
headingLevel2 – 63Heading level of the day titles, to fit the page outline.
emptyReactNode"No activity yet."Shown when there are no events.