@molecule/app-leaderboard-row-svelte

Feature · leaderboard-row · App (browser) · v1.1.5 · Apache-2.0

Leaderboard row — rank, avatar, name, score, optional change indicator

npm install @molecule/app-leaderboard-row-svelte

npm · Source on GitHub

How it works

@molecule/app-leaderboard-row-svelte is a ready-made leaderboard-row feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

<script lang="ts">
  import { LeaderboardRow } from '@molecule/app-leaderboard-row-svelte'
</script>

<LeaderboardRow
  rank={1}
  name="Alice Chen"
  avatarSrc="/avatars/alice.png"
  score={4820}
  rankDelta={2}
  subtitle="Team Phoenix"
  isMe={false}
  onClick={() => openProfile('alice')}
/>

Works with: @molecule/app-svelte, @molecule/app-ui, @molecule/app-ui-svelte

Reference

Svelte leaderboard row.

Exports <LeaderboardRow> — rank + avatar + name + score with optional rank-delta indicator, subtitle, and current-user highlight. Props: rank, name, score, avatarSrc?, rankDelta?, subtitle?, isMe?, onClick?, className? — the node props are snippets. It is the Svelte counterpart of @molecule/app-leaderboard-row-react: same props and the same DOM for the same input.

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.

Quick Start

<script lang="ts">
  import { LeaderboardRow } from '@molecule/app-leaderboard-row-svelte'
</script>

<LeaderboardRow
  rank={1}
  name="Alice Chen"
  avatarSrc="/avatars/alice.png"
  score={4820}
  rankDelta={2}
  subtitle="Team Phoenix"
  isMe={false}
  onClick={() => openProfile('alice')}
/>

Type

feature

Installation

npm install @molecule/app-leaderboard-row-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte

API

Interfaces

LeaderboardRowProps

Props accepted by the LeaderboardRow component — the same props @molecule/app-leaderboard-row-react accepts. Node props are snippets.

interface LeaderboardRowProps {
  /** 1-based rank. */
  rank: number
  /** Display name (a string or a snippet). */
  name: Snippet | string
  /** Optional avatar URL. */
  avatarSrc?: string
  /** Score / metric (a string, a number, or a snippet). */
  score: Snippet | string | number
  /** Optional change indicator (positive = climbed). */
  rankDelta?: number
  /** Optional secondary line (team, level, country; a string or a snippet). */
  subtitle?: Snippet | string
  /** Whether this row represents the current user (highlighted). */
  isMe?: boolean
  /** Click handler. */
  onClick?: () => void
  /** Extra classes. */
  className?: string
}

Constants

LeaderboardRow

const LeaderboardRow: LegacyComponentType

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-svelte ^3.13.0 || ^4.0.0
  • @molecule/app-ui ^1.4.0
  • @molecule/app-ui-svelte ^1.1.0
  • svelte ^5.0.0

Runtime Dependencies

  • @molecule/app-svelte

  • @molecule/app-ui

  • @molecule/app-ui-svelte

  • svelte

  • Ranks 1–3 render medal emoji (gold/silver/bronze) INSTEAD of the rank number; rank 4+ renders #n. There is no prop to disable the medals.

  • rankDelta arrows use hardcoded green/red hex colors and isMe uses a fixed light-blue translucent background — neither follows the app theme, and the isMe tint is tuned for light backgrounds. Override via className where that clashes with a dark theme.

  • When name is not a plain string the avatar's accessible name falls back to the hardcoded English string 'Player' — pass a string name in localized apps.

  • onClick gives the row a pointer cursor but no keyboard/role semantics.

  • Requires a wired ClassMap bond; <Avatar> comes from @molecule/app-ui-svelte.