npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@molecule/app-loyalty-tier-badge-react

v1.0.2

Published

Bronze/Silver/Gold/Platinum loyalty tier badge with progress to next tier — hotels, airlines, retail rewards

Readme

@molecule/app-loyalty-tier-badge-react

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.ts JSDoc, 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.

Quick Start

import { LoyaltyTierBadge } from '@molecule/app-loyalty-tier-badge-react'

;<LoyaltyTierBadge tier="gold" points={42_000} nextTierThreshold={75_000} />

Type

feature

Installation

npm install @molecule/app-loyalty-tier-badge-react @molecule/app-i18n @molecule/app-react @molecule/app-ui react
npm install -D @types/react

API

Interfaces

LoyaltyTierBadgeProps

Props 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
}

Types

LoyaltyTier

Standard loyalty tier rungs.

type LoyaltyTier = 'bronze' | 'silver' | 'gold' | 'platinum'

Functions

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.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-i18n ^1.0.1
  • @molecule/app-react ^1.0.1
  • @molecule/app-ui ^1.0.1
  • react ^18.0.0 || ^19.0.0

Runtime Dependencies

  • @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.

Translations

Translation strings are provided by @molecule/app-locales-loyalty-tier-badge.