@molecule/app-leaderboard-row-vue
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-vueHow it works
@molecule/app-leaderboard-row-vue 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 { createApp, defineComponent, h } from 'vue'
import { LeaderboardRow } from '@molecule/app-leaderboard-row-vue'
const App = defineComponent({
setup() {
return () =>
h(LeaderboardRow, {
rank: 1,
name: 'Alice Chen',
avatarSrc: '/avatars/alice.png',
score: 4820,
rankDelta: 2,
subtitle: 'Team Phoenix',
isMe: false,
onClick: () => openProfile('alice'),
})
},
})
createApp(App).mount('#app')Works with: @molecule/app-ui, @molecule/app-ui-vue, @molecule/app-vue
Reference
Vue 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 Vue 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.tsJSDoc, not this file.
Quick Start
import { createApp, defineComponent, h } from 'vue'
import { LeaderboardRow } from '@molecule/app-leaderboard-row-vue'
const App = defineComponent({
setup() {
return () =>
h(LeaderboardRow, {
rank: 1,
name: 'Alice Chen',
avatarSrc: '/avatars/alice.png',
score: 4820,
rankDelta: 2,
subtitle: 'Team Phoenix',
isMe: false,
onClick: () => openProfile('alice'),
})
},
})
createApp(App).mount('#app')
Type
feature
Installation
npm install @molecule/app-leaderboard-row-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
API
Interfaces
LeaderboardRowProps
Props accepted by the LeaderboardRow component — the same props
@molecule/app-leaderboard-row-react accepts.
interface LeaderboardRowProps {
/** 1-based rank. */
rank: number
/** Display name. Passed as a prop or as the same-named slot — both work. */
name: VNodeChild
/** Optional avatar URL. */
avatarSrc?: string
/** Score / metric. Passed as a prop or as the same-named slot — both work. */
score: VNodeChild
/** Optional change indicator (positive = climbed). */
rankDelta?: number
/** Optional secondary line (team, level, country). */
subtitle?: VNodeChild
/** Whether this row represents the current user (highlighted). */
isMe?: boolean
/** Click handler. */
onClick?: () => void
/** Extra classes. */
className?: string
}
Constants
LeaderboardRow
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). Node-valued props (name, score,
subtitle) arrive as a prop AND a same-named slot; the component accepts
either.
const LeaderboardRow: DefineComponent<
ExtractPropTypes<{
rank: { type: NumberConstructor; required: true }
name: null
avatarSrc: { type: StringConstructor; default: undefined }
score: null
rankDelta: { type: NumberConstructor; default: undefined }
subtitle: null
isMe: { type: BooleanConstructor; default: undefined }
onClick: { type: PropType<() => void>; default: undefined }
className: { type: StringConstructor; default: undefined }
}>,
() => VNode,
{},
{},
{},
ComponentOptionsMixin,
ComponentOptionsMixin,
{},
string,
PublicProps,
Readonly<
ExtractPropTypes<{
rank: { type: NumberConstructor; required: true }
name: null
avatarSrc: { type: StringConstructor; default: undefined }
score: null
rankDelta: { type: NumberConstructor; default: undefined }
subtitle: null
isMe: { type: BooleanConstructor; default: undefined }
onClick: { type: PropType<() => void>; default: undefined }
className: { type: StringConstructor; default: undefined }
}>
> &
Readonly<{}>,
{ avatarSrc: string; rankDelta: number; isMe: boolean; onClick: () => void; className: string },
{},
{},
{},
string,
ComponentProvideOptions,
true,
{},
any
>
props— Component props (seeLeaderboardRowProps).
Returns: The leaderboard row component.
Injection Notes
Requirements
Peer dependencies:
@molecule/app-ui^1.4.0@molecule/app-ui-vue^1.1.0@molecule/app-vue^3.13.0 || ^4.0.0vue^3.4.0
Runtime Dependencies
-
@molecule/app-ui -
@molecule/app-ui-vue -
@molecule/app-vue -
vue -
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. -
rankDeltaarrows use hardcoded green/red hex colors andisMeuses a fixed light-blue translucent background — neither follows the app theme, and theisMetint is tuned for light backgrounds. Override viaclassNamewhere that clashes with a dark theme. -
When
nameis not a plain string the avatar's accessible name falls back to the hardcoded English string 'Player' — pass a stringnamein localized apps. -
onClickgives the row a pointer cursor but no keyboard/role semantics. -
Requires a wired ClassMap bond;
<Avatar>comes from@molecule/app-ui-vue. Node-valued props (name,score,subtitle) arrive as a prop AND a same-named slot; the component accepts either.