CancellationPolicyBadge
Trust-signal badge for activity, hotel, and cruise cards. Three color-coded tiers (flexible/moderate/strict) with a Popover that reveals the full refund schedule and optional terms link. Presentational; ships with a co-located pure helper deriveCancellationTier for callers that need to classify a policy at runtime.
Three tiers
Click each badge to reveal the refund schedule. Tab / Enter / Escape are supported.
Refund ladder with absolute deadlines
When deadlineIso is provided per rule, the popover shows the formatted local date and time using the locale prop.
In a card (size='sm')
The size="sm" variant is designed to sit inside a result card or room-type tile.
Deluxe King Room
City-view, 32 m² — 1 King bed
$450
per night
deriveCancellationTier
The exported deriveCancellationTier(rules, options?) pure function classifies a rules array into a tier. Use it in search-card renderers where the raw policy is available but the tier is not.
deriveCancellationTier(rules) → flexible
Props reference
| Prop | Type | Required | Description |
|---|---|---|---|
| tier | 'flexible' | 'moderate' | 'strict' | yes | Controls badge color and icon |
| label | string | yes | Text shown inside the trigger |
| rules | CancellationRule[] | yes | Refund schedule shown in the popover |
| rules[].hoursBefore | number | null | yes | Hours before start; null = any time / at booking |
| rules[].refundPercent | number (0–100) | yes | Refund percentage for this rule |
| rules[].deadlineIso | string (ISO) | no | Absolute deadline shown instead of 'N hours before' |
| rules[].note | string | no | Optional per-rule note |
| popoverTitle | string | no (default 'Cancellation policy') | Heading inside the popover |
| termsUrl | string | no | Renders 'View full terms →' link in the popover |
| onOpenPolicy | () => void | no | Fired once on closed → open (analytics) |
| open | boolean | no | Controlled open state |
| onOpenChange | (open: boolean) => void | no | Called with each open-state change |
| locale | string (BCP-47) | no (default 'en-AU') | Used to format deadlineIso dates |
| size | 'sm' | 'md' | no (default 'md') | Trigger size; 'sm' for use inside cards |
| triggerAriaLabel | string | no | Overrides the derived aria-label on the trigger |
| id | string | no (default useId()) | Popover content id used for aria-describedby |
| className | string | no | Extra classes on the trigger |