Activity feed
A chronological feed of what happened, toned by kind of event.
Purpose
The "Recent activity" panel on a dashboard: a vertical list of events, each with a tone-coloured icon chip, a description, an optional context line and a relative timestamp. It is a plain list — place it inside a Card with a heading to make a panel of it. For the dated, connected history of a single record (one claim's approval trail), use the Timeline primitive instead.
Use it for
- Recent-events panels: approvals, guarantee letters, onboarding
- Cross-record audit trails, newest first
Reach for something else
- One record's dated history → Timeline
- Rows users act on (amounts, statuses) → Claims list or DataGrid
Example
Claim #4821 approved
by Josephine Lim
Guarantee letter issued
Pantai Hospital KL
Claim #4817 denied
Out of entitlement
12 members onboarded
Acme Sdn Bhd
Each item is plain data — icon takes a typed HealthMetrics icon name, time a pre-formatted
relative string:
import { ActivityFeed } from "@healthmetrics/ui/activity-feed";
<ActivityFeed
items={[
{
id: "1",
icon: "approve",
title: "Claim #4821 approved",
meta: "by Josephine Lim",
time: "2m",
tone: "success",
},
// …
]}
/>;Tones
tone colours the icon chip by intent — default, success, warning, destructive. It is a
visual accent only: the title text must say what happened.
Claim approved
Success tone
Claim flagged late
Warning tone
Claim denied
Destructive tone
Audit log recorded
Default tone
Structure
| Property | Value |
|---|---|
| List | <ul>, 4px row gap (space-y-1) |
| Row | 8px padding, --radius-md, --muted wash on hover |
| Icon chip | 36px circle (size-9), 20px icon, tone-coloured fill and glyph |
| Title | 14px --foreground (text-sm) |
| Meta | 12px --muted-foreground, single line, truncates |
| Time | 12px --muted-foreground <time>, right-aligned |
| Tones | default --accent · success/warning subtle fills · destructive 10% wash |
Best practices
Do
- Order items newest first and keep
timeshort and relative ("2m","1h","3h"). - Say the outcome in the title (
"Claim #4817 denied") — the tone chip only echoes it. - Keep
metato one line of context (actor, clinic, employer); it truncates, it never wraps. - Wrap the feed in a Card with a heading such as "Recent activity", and cap it at a handful of items with a link to the full log.
- Give every item a stable
id— it is the React key.
Don't
- Rely on the tone colour to carry meaning — it is invisible to screen readers and fails colour-blind users.
- Put actions or links in
meta— the feed announces, it does not operate; link to the record fromtitleif needed. - Render an empty array and call it done — the component renders nothing, so supply your own empty state ("No activity yet").
Accessibility & keyboard
- Semantic
<ul>/<li>markup — screen readers announce the list and its length. - Icons are decorative (
aria-hidden); each row reads as title, then meta, then time. tonechanges colour only — no role, no announcement. The title text must carry the outcome.- The timestamp renders in a
<time>element with no machine-readabledatetime, so the string you pass is exactly what is read — keep it intelligible ("2m", not "2"). - Keyboard: none of the feed's own — rows are not focusable. Any link you place inside a
titlereceives focus in DOM order.
Props
ActivityFeed takes two props: items (the array described below) and an optional className
on the list.
| Prop | Type | Default | Description |
|---|---|---|---|
idrequired | string | — | Stable unique key for the row. |
iconrequired | "insurer" | "corporateOrganisation" | "partneredProviders" | "revenue" | "searchMembers" | "treatments" | "tickets" | "financeMenu" | "emailTemplates" | "masterFile" | "sms" | "claims" | "guaranteeLetters" | "financeTransactions" | "payments" | "signatures" | "reports" | "administration" | "action" | "menu" | "debugTools" | "exportToExcel" | "download" | "import" | "upload" | "upgrade" | "search" | "nextPage" | "previousPage" | "lastOfThePages" | "firstOfThePages" | "refresh" | "expandDown" | "expandRight" | "collapseUp" | "createNew" | "addNew" | "addNewProfile" | "information" | "email" | "folderClose" | "folderOpen" | "print" | "generateReport" | "share" | "bank" | "messageReceivedOnly" | "messageCanReply" | "pdpa" | "security" | "healthRelatedInsurance" | "tutorial" | "referralLetter" | "fieldDropDown" | "navigationDown" | "navigationUp" | "filterExpand" | "filterCollapse" | "externalLink" | "receipt" | "covid19Screening" | "collateral" | "creditLimitAndBalance" | "billingOverview" | "memberInformation" | "employees" | "medicalLeaves" | "analysis" | "comparison" | "homepage" | "dashboard" | "benefitGroups" | "makePayments" | "principal" | "dependants" | "remove" | "delete" | "approve" | "reject" | "cancel" | "delegate" | "batchAction" | "switchAccount" | "calendar" | "insurance" | "department" | "subsidiary" | "billingAccount" | "claimPolicies" | "default" | "globalUniversal" | "edit" | "allow" | "deny" | "addOn" | "revenueSubscription" | "help" | "contact" | "changePassword" | "manageAccount" | "login" | "loginActivities" | "logout" | "hospital" | "pharmacy" | "prescription" | "ultrasound" | "languages" | "map" | "details" | "properties" | "confirmation" | "newCheckIn" | "patientCheckIns" | "allGood" | "transactions" | "patient" | "lateClaims" | "doctors" | "outpatientSpecialist" | "inpatientHospitalisation" | "roles" | "users" | "auditLogs" | "ascending" | "descending" | "chart" | "mobileAppEnabled" | "reimbursementClaims" | "preEmployment" | "gp" | "dental" | "optical" | "specialist" | "hospitalisation" | "maternity" | "healthScreening" | "pharmacy2" | "customTreatments" | "allergyAndImmunology" | "anaesthesiology" | "cardiologyAndAngiology" | "dentistry" | "dermatology" | "emergencyDepartment" | "endocrinology" | "gastroenterologyAndHepatology" | "generalSurgery" | "geriatricMedicine" | "haematology" | "infectiousDisease" | "internalMedicine" | "nephrology" | "neurology" | "obstetricsAndGynaecology" | "occupationalHealthAndVaccine" | "oncology" | "ophthalmology" | "oralAndMaxillofacial" | "orthopaedic" | "ent" | "paediatricDentistry" | "paediatrics" | "podiatry" | "psychiatry" | "pulmonologyAndRespiratory" | "radiologyAndImaging" | "reconstructivePlastic" | "rehabilitationMedicine" | "rheumatology" | "urology" | "vascularSurgery" | "xRay" | "femaleDoctorAvailable" | "open24Hours" | "covidTestRtk" | "covidTestPcr" | — | Leading icon, keyed by typed HealthMetrics icon name. |
titlerequired | React.ReactNode | — | Primary line — the event description. |
meta | string | undefined | — | Optional secondary line, e.g. actor or context. |
timerequired | string | — | Relative timestamp shown on the right, e.g. "2m", "1h" — produce it with `formatRelative(value, { now, style: "short" })`. A pre-formatted string, not a Date: the caller owns `now`, so both render passes of a static export agree byte for byte. |
dateTime | string | undefined | — | Machine-readable instant for the `<time>` element, ISO 8601 — produce it with `toISODate` (or pass the API's timestamp straight through). |
tone | "default" | "success" | "warning" | "destructive" | undefined | "default" | Colour tone of the icon chip; maps to intent. |