newOS for Developers
Back to Overview
LeaderBoard
outputgamificationA ranked list component for displaying user standings with scores, rankings, and customizable sorting options.
Source Path
apps/web/Components/Gamification/LeaderBoard.tsxPackage
@newos/web
Props Interface
interface LeaderBoardProps {
users: LeaderBoardUser[]; // Array of users with scores
limit?: number; // Max users to display (default: 10)
showRank?: boolean; // Show rank numbers/icons (default: true)
showScore?: boolean; // Show score values (default: true)
sortBy?: "score" | "name" | "recent"; // Sort order
onUserClick?: (user: LeaderBoardUser) => void; // Click handler
className?: string; // Additional classes
}
interface LeaderBoardUser {
id: string;
name: string;
username: string;
score: number;
avatarUrl?: string;
}Key Features
Rank Icons
Top 3 positions display trophy/medal icons. Positions 4+ show numeric rankings.
Flexible Sorting
Sort by score (default), alphabetical name, or most recently active.
Score Formatting
Scores are automatically formatted with locale-appropriate number separators.
User Avatars
Integrates with UserAvatar component for consistent user representation.
Rank Icons
1st Place
2nd Place
3rd Place
44th+ Place