← All @molecule/* packages · App templates
@molecule/app-loyalty-tier-badge-reactFeature · loyalty-tier-badge · App (browser) · v1.0.1 · Apache-2.0
Bronze/Silver/Gold/Platinum loyalty tier badge with progress to next tier — hotels, airlines, retail rewards
npm install @molecule/app-loyalty-tier-badge-react@molecule/app-loyalty-tier-badge-react is a ready-made loyalty-tier-badge feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { LoyaltyTierBadge } from '@molecule/app-loyalty-tier-badge-react'
;<LoyaltyTierBadge tier="gold" points={42_000} nextTierThreshold={75_000} />Works with: @molecule/app-i18n, @molecule/app-react, @molecule/app-ui
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Bronze/Silver/Gold/Platinum loyalty tier badge with optional progress bar to the next tier.
Exports:
<LoyaltyTierBadge> — colored tier glyph + label; when BOTH points and
nextTierThreshold are set (and a next tier exists) it also renders a
progress bar plus an "X to next tier" readout; platinum shows "Top tier
reached" instead. Props: tier, points?, nextTierThreshold?,
tierLabel? / nextTierLabel? (override the translated names for branded
programs, e.g. "Member" / "Elite"), size? ('sm' | 'md' | 'lg'),
dataMolId?, className?.LoyaltyTier, LoyaltyTierBadgeProps types; computeProgress() and
nextTierOf() helpers.import { LoyaltyTierBadge } from '@molecule/app-loyalty-tier-badge-react'
;<LoyaltyTierBadge tier="gold" points={42_000} nextTierThreshold={75_000} />
feature
npm install @molecule/app-loyalty-tier-badge-react @molecule/app-i18n @molecule/app-react @molecule/app-ui react
npm install -D @types/react
LoyaltyTierBadgePropsProps for {@link LoyaltyTierBadge}.
interface LoyaltyTierBadgeProps {
/** Current tier. */
tier: LoyaltyTier
/**
* Member's current points / nights / qualifying activity in the tier
* unit. Optional; when present and `nextTierThreshold` is also given the
* badge renders a progress bar and "X to next tier" readout.
*/
points?: number
/**
* Threshold (in the same unit as `points`) at which the next tier is
* earned. Combined with `points` to compute progress.
*/
nextTierThreshold?: number
/** Override the auto-derived next-tier label (e.g. "Diamond"). */
nextTierLabel?: string
/** Override the displayed tier label (defaults to translated tier name). */
tierLabel?: string
/** Display size. */
size?: 'sm' | 'md' | 'lg'
/** `data-mol-id` attribute for AI-agent selectors. */
dataMolId?: string
/** Extra classes appended via the ClassMap `cn()` helper. */
className?: string
}
LoyaltyTierStandard loyalty tier rungs.
type LoyaltyTier = 'bronze' | 'silver' | 'gold' | 'platinum'
computeProgress(points, threshold)Compute progress (0–1) toward the next tier given current points + threshold.
function computeProgress(points?: number, threshold?: number): number
points — Current points balance.threshold — Points needed to reach the next tier.Returns: Clamped 0–1 progress ratio.
LoyaltyTierBadge(props)Loyalty tier badge — renders a colored glyph + tier label + (optional) "X / Y to next tier" progress bar. Used by hotel-booking, online-store, and travel-booking flagship loyalty programs.
Tier glyph colors are always the standard metallic accents (fixed per-tier
hex values — theme tokens are not consulted for the glyph); pass
tierLabel / nextTierLabel to override the translated defaults for
branded programs (e.g. "Member" / "Elite").
function LoyaltyTierBadge({
tier,
points,
nextTierThreshold,
nextTierLabel,
tierLabel,
size = 'md',
dataMolId,
className,
}: LoyaltyTierBadgeProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>
props — Component props.Returns: The rendered tier badge.
nextTierOf(tier)Resolve the next tier name (lowercase) given the current tier. Returns
null when the member is already at the highest tier.
function nextTierOf(tier: LoyaltyTier): LoyaltyTier | null
tier — Current tier.Returns: The next-tier name or null if at the top.
Peer dependencies:
@molecule/app-i18n ^1.0.1@molecule/app-react ^1.0.1@molecule/app-ui ^1.0.1react ^18.0.0 || ^19.0.0@molecule/app-i18n
@molecule/app-react
@molecule/app-ui
react
The tier glyph accent is ALWAYS a fixed metallic hex per tier (bronze /
silver / gold / platinum) — it does not read theme tokens; only the border
and secondary text use --mol-color- variables (with light-theme fallbacks).
Labels route through t() under the loyaltyTierBadge. prefix. The
companion @molecule/app-locales-loyalty-tier-badge bond currently ships
only group and progress — the tier names, remaining, and topTier
strings fall back to English everywhere until the bond gains those keys
(or pass tierLabel / nextTierLabel yourself).
points / nextTierThreshold must share a unit (points, nights, spend);
progress is clamped to 0–1.
Translation strings are provided by @molecule/app-locales-loyalty-tier-badge.