Entitlement progress
Usage against an entitlement limit, with thresholds that change tone as the cap approaches.
Purpose
Benefit-utilisation bars: how much of each entitlement a member or benefit group has consumed,
with the bar and figure changing tone as the cap approaches. Each row is a label with icon, a
"used / total" figure and a filled bar. It deliberately does not wrap the
Progress primitive — it renders its own bar with no
progressbar role, because the exact figure already sits beside it as text (see
Accessibility). For a generic single task-completion bar, use
Progress.
Use it for
- Member benefit balances: GP visits, dental and optical caps
- Benefit-group utilisation on employer dashboards
Example
import { EntitlementProgress } from "@healthmetrics/ui/entitlement-progress";
<EntitlementProgress
items={[
{ label: "GP", icon: "gp", used: 8, total: 12 },
{ label: "Dental", icon: "dental", used: 480, total: 500, unit: "MYR" }, // "MYR 480 / 500"
]}
/>;Thresholds
The bar fills used / total and changes tone with the figure: primary below 80%, warning
(--warning) from 80%, destructive (--destructive) at 100%. The usage text follows — muted
normally, then semibold in the matching tone.
The fill is clamped to 0–100%: over-consumption caps at a full destructive bar, and a negative
balance, a zero total or a non-finite ratio all render an empty bar rather than a broken one.
The figure still shows the real numbers.
Units and formatting
unit decides how the "used / total" figure reads:
- A 3-letter ISO 4217 code (
"MYR","SGD") leads the pair —MYR 480 / 500, whole units, no decimals. Both halves are formatted under the same digit-grouping convention for that currency:MYR 480,000 / 500,000,EUR 480.000 / 500.000,INR 4,80,000 / 5,00,000. This is a tested guarantee — a mixed string such asEUR 480.000 / 500,000cannot ship. - Any other unit trails as a word —
12 / 20 visits. - No unit renders the bare ratio —
2 / 6.
The currency check is on shape (three uppercase letters), so write suffix units in lower case:
"visits", not "VST".
Structure
| Property | Value |
|---|---|
| Rows | 16px stack gap (space-y-4) |
| Label | 14px / Inter 500 with an 18px muted icon |
| Usage text | 14px tabular-nums; muted → --warning-text semibold at 80% → --destructive semibold at 100% |
| Track | 8px tall (h-2), full-round, --secondary fill |
| Fill | --primary → --warning at 80% → --destructive at 100%, animated (transition-all) |
Best practices
Do
- Pass raw numbers for
usedandtotal— the component formats the figure. - Use an ISO 4217 code for monetary entitlements and lower-case words for visit-type units.
- Keep
labelunique within one widget — it is the React key for the row. - Keep the list short (a member's handful of benefits); it is a balance summary, not a report.
Don't
- Pre-format amounts into
labelor bolt units onto the numbers — that isunit's job. - Use a three-uppercase-letter suffix unit (
"PCS","KMS") — the shape test reads it as a currency and moves it in front of the figure. - Use it for task progress or loading — that is Progress.
Accessibility & keyboard
- The bar is deliberately not a
progressbar: the exact "used / total" figure sits beside it as text, and adding the role would make screen readers announce the same value twice. A test pins this contract — the value must stay readable as text. - Each row reads as label, then figure (
"MYR 480 / 500","8 / 12"); the icon is decorative (aria-hidden). - The near-limit and at-limit tones are paired with a weight change and, above all, the figure itself — colour never carries the state alone.
- Figures are
tabular-nums, so they align down the list. - Keyboard: none — the widget is not interactive.
Props
EntitlementProgress takes two props: items (the array described below) and an optional
className on the container.
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | string | — | Benefit name, e.g. "GP", "Dental". |
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. |
usedrequired | number | — | Amount consumed so far. |
totalrequired | number | — | Total entitlement; the bar fills `used / total`. |
unit | string | undefined | — | Optional unit. Any 3-letter ISO 4217 code — "MYR", "SGD", or `DEFAULT_CURRENCY_CODE` from `lib/currency` — is rendered as a prefix (`MYR 480 / 500`); any other unit is appended as a suffix (`12 / 20 visits`). Because the check is on shape, a three-uppercase-letter unit is read as a currency — write suffix units in lower case (`visits`, `sessions`). |