YYonda UI Docs

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.

Hover the badge, then click to see the refund ladder with absolute deadlines.

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.

Preset:

deriveCancellationTier(rules) → flexible

Props reference

PropTypeRequiredDescription
tier'flexible' | 'moderate' | 'strict'yesControls badge color and icon
labelstringyesText shown inside the trigger
rulesCancellationRule[]yesRefund schedule shown in the popover
rules[].hoursBeforenumber | nullyesHours before start; null = any time / at booking
rules[].refundPercentnumber (0–100)yesRefund percentage for this rule
rules[].deadlineIsostring (ISO)noAbsolute deadline shown instead of 'N hours before'
rules[].notestringnoOptional per-rule note
popoverTitlestringno (default 'Cancellation policy')Heading inside the popover
termsUrlstringnoRenders 'View full terms →' link in the popover
onOpenPolicy() => voidnoFired once on closed → open (analytics)
openbooleannoControlled open state
onOpenChange(open: boolean) => voidnoCalled with each open-state change
localestring (BCP-47)no (default 'en-AU')Used to format deadlineIso dates
size'sm' | 'md'no (default 'md')Trigger size; 'sm' for use inside cards
triggerAriaLabelstringnoOverrides the derived aria-label on the trigger
idstringno (default useId())Popover content id used for aria-describedby
classNamestringnoExtra classes on the trigger