GitHub165

Milestone Card

React milestone card with totals, featured badges, and scrollable lists for profile and progress surfaces. Fits consumer, SaaS and community products. Open source, built on shadcn/ui + Tailwind.

The Milestone Card summarizes a user's progress in one place—headline stats, spotlighted badges, and scrollable collections without leaving the card, suited to profile pages and progress hubs.

4

Badges Unlocked

8% of usersWellness God
24% of users10 day streak
5% of usersChatbot King

All Milestones

Wellness God

Meditate 30 days in a row

10 day streak

Open app for 10 days

60%

Chatbot King

Chat with AI 500 times

Fully Hydrated Bro

Drink 5,000L of water total

32%

Installation

npx shadcn@latest add https://ui.trophy.so/milestone-card

Usage

import { MilestoneCard } from "@/components/ui/milestone-card"
<MilestoneCard
  highlightedMilestones={[
    {
      id: "highlight-1",
      name: "Wellness God",
      trigger: "streak",
      achievedAt: "2024-01-01T00:00:00Z",
      rarity: 8,
    },
    {
      id: "highlight-2",
      name: "10 day streak",
      trigger: "streak",
      achievedAt: "2024-01-01T00:00:00Z",
      rarity: 24,
    },
    {
      id: "highlight-3",
      name: "Chatbot King",
      trigger: "api",
      achievedAt: "2024-01-01T00:00:00Z",
      rarity: 5,
    },
  ]}
  milestones={[
    {
      id: "list-1",
      name: "10 day streak",
      description: "Open app for 10 days",
      trigger: "streak",
      achievedAt: "2024-01-01T00:00:00Z",
      progress: 60,
    },
    {
      id: "list-2",
      name: "Fully Hydrated Bro",
      description: "Drink 5,000L of water total",
      trigger: "metric",
      achievedAt: "2024-01-01T00:00:00Z",
      progress: 32,
    },
  ]}
/>

Examples

Basic Usage

4

Badges Unlocked

8% of usersWellness God
24% of users10 day streak
5% of usersChatbot King

All Milestones

Wellness God

Meditate 30 days in a row

10 day streak

Open app for 10 days

60%

Chatbot King

Chat with AI 500 times

Fully Hydrated Bro

Drink 5,000L of water total

32%
<MilestoneCard
  highlightedMilestones={[
    {
      id: "highlight-1",
      name: "Wellness God",
      trigger: "streak",
      achievedAt: "2024-01-01T00:00:00Z",
      rarity: 8,
    },
    {
      id: "highlight-2",
      name: "10 day streak",
      trigger: "streak",
      achievedAt: "2024-01-01T00:00:00Z",
      rarity: 24,
    },
    {
      id: "highlight-3",
      name: "Chatbot King",
      trigger: "api",
      achievedAt: "2024-01-01T00:00:00Z",
      rarity: 5,
    },
  ]}
  milestones={[
    {
      id: "list-1",
      name: "10 day streak",
      description: "Open app for 10 days",
      trigger: "streak",
      achievedAt: "2024-01-01T00:00:00Z",
      progress: 60,
    },
    {
      id: "list-2",
      name: "Fully Hydrated Bro",
      description: "Drink 5,000L of water total",
      trigger: "metric",
      achievedAt: "2024-01-01T00:00:00Z",
      progress: 32,
    },
  ]}
/>

With Trophy

Use the Trophy SDK to fetch a user's milestones server-side. Milestones are served by Trophy's achievements API:

import { TrophyApiClient } from '@trophyso/node';

const trophy = new TrophyApiClient({
  apiKey: 'YOUR_API_KEY'
});

const response = await trophy.users.achievements("user-id");

Then pass and transform the response into MilestoneCard props in your UI layer:

const milestones = response
const highlightedMilestones = milestones.slice(0, 3)

<MilestoneCard
  highlightedMilestones={highlightedMilestones}
  milestones={milestones}
/>

API Reference

PropTypeDefaultDescription
highlightedMilestonesUserMilestone[]RequiredSeparate featured milestones shown in the top section
milestonesUserMilestone[]RequiredList milestones rendered in the lower section and used for totals
badgeSize"sm" | "default" | "lg""default"Badge size used by the lower list
lockedStyle"grayscale" | "silhouette" | "hidden""grayscale"Locked row presentation in the embedded MilestoneList
onMilestoneClick(milestone) => void-Click handler for badges and list rows