@molecule/app-leaderboard-row-solid

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

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

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

npm · Source on GitHub

How it works

@molecule/app-leaderboard-row-solid 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.

import { LeaderboardRow } from '@molecule/app-leaderboard-row-solid'

export function TopPlayers() {
  return (
    <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-solid, @molecule/app-ui, @molecule/app-ui-solid

Reference

Solid 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?. It is the Solid 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

import { LeaderboardRow } from '@molecule/app-leaderboard-row-solid'

export function TopPlayers() {
  return (
    <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-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js

API

Interfaces

LeaderboardRowProps

Props accepted by the LeaderboardRow component.

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

Functions

LeaderboardRow(props)

Leaderboard row — rank + avatar + name + score + optional rank-delta arrow. Top 3 ranks render a medal in place of the numeric rank. Ranks 1–3 render medal emoji instead of the rank number; there is no prop to disable them. When name is not a plain string the Avatar's accessible name falls back to 'Player'. With onClick the row is a button in the a11y tree (Enter / Space activate it).

function LeaderboardRow(props: LeaderboardRowProps): JSX.Element
  • props — Component props (see LeaderboardRowProps).

Returns: The rendered leaderboard row.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-solid ^3.14.0 || ^4.0.0
  • @molecule/app-ui ^1.4.0
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-solid

  • @molecule/app-ui

  • @molecule/app-ui-solid

  • solid-js

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