@molecule/app-leaderboard-list-vue

Feature · leaderboard-list · App (browser) · v1.1.3 · Apache-2.0

Wrapper list above leaderboard rows with podium / top-N highlighting

npm install @molecule/app-leaderboard-list-vue

npm · Source on GitHub

How it works

@molecule/app-leaderboard-list-vue is a ready-made leaderboard-list 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 { LeaderboardList } from '@molecule/app-leaderboard-list-vue'

const entries = [
  { id: 'u1', rank: 1, name: 'Alice Chen', score: 4820 },
  { id: 'u2', rank: 2, name: 'Bo Diaz', score: 4515 },
]

const App = defineComponent({
  setup() {
    return () =>
      h(
        LeaderboardList,
        { title: 'Top Contributors' },
        {
          default: () =>
            entries.map((e) =>
              h('div', { key: e.id }, [
                h('span', `${e.rank}. ${e.name}`),
                h('strong', String(e.score)),
              ]),
            ),
        },
      )
  },
})

createApp(App).mount('#app')

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

Reference

Vue leaderboard list container.

Exports <LeaderboardList> — header row (title + actions) above a vertical stack of rows. Props: default slot (pre-rendered rows), title?, actions? (period selector, filters), emptyState?, className?. Pair with a row component (@molecule/app-leaderboard-row-react in React apps; your own Vue rows otherwise) — this container adds no rank/podium logic of its own. It is the Vue counterpart of @molecule/app-leaderboard-list-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 { createApp, defineComponent, h } from 'vue'
import { LeaderboardList } from '@molecule/app-leaderboard-list-vue'

const entries = [
  { id: 'u1', rank: 1, name: 'Alice Chen', score: 4820 },
  { id: 'u2', rank: 2, name: 'Bo Diaz', score: 4515 },
]

const App = defineComponent({
  setup() {
    return () =>
      h(
        LeaderboardList,
        { title: 'Top Contributors' },
        {
          default: () =>
            entries.map((e) =>
              h('div', { key: e.id }, [
                h('span', `${e.rank}. ${e.name}`),
                h('strong', String(e.score)),
              ]),
            ),
        },
      )
  },
})

createApp(App).mount('#app')

Type

feature

Installation

npm install @molecule/app-leaderboard-list-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue

API

Interfaces

LeaderboardListProps

Props accepted by the LeaderboardList component — the same props @molecule/app-leaderboard-list-react accepts.

interface LeaderboardListProps {
  /**
   * Pre-rendered leaderboard rows — the DEFAULT slot. Map your entries (as in
   * the example) so the empty case is detectable; a fragment or single
   * element keeps the list rendered.
   */
  children?: VNodeChild
  /** Optional title above the list. Passed as a prop or as the same-named slot — both work. */
  title?: VNodeChild
  /** Optional period selector / actions row. Passed as a prop or as the same-named slot — both work. */
  actions?: VNodeChild
  /** Optional empty state. Rendered only when the default slot is empty. */
  emptyState?: VNodeChild
  /** Extra classes. */
  className?: string
}

Constants

LeaderboardList

Container above a stack of rows — header + actions + the list. Doesn't itself render rank logic; pair with <LeaderboardRow> from @molecule/app-leaderboard-row-react (or your own rows).

The emptyState renders only when the default slot is empty; map your entries directly (as in the example) so the empty case is detectable.

const LeaderboardList: DefineComponent<
  ExtractPropTypes<{
    title: null
    actions: null
    emptyState: null
    className: { type: PropType<string | undefined>; default: undefined }
  }>,
  () => VNode,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      title: null
      actions: null
      emptyState: null
      className: { type: PropType<string | undefined>; default: undefined }
    }>
  > &
    Readonly<{}>,
  { className: string | undefined },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see LeaderboardListProps).

Returns: The leaderboard list component.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-vue ^1.1.0
  • @molecule/app-vue ^3.13.0 || ^4.0.0
  • vue ^3.4.0

Runtime Dependencies

  • @molecule/app-ui

  • @molecule/app-ui-vue

  • @molecule/app-vue

  • vue

  • emptyState renders only when the default slot is empty; if you pass a fragment or a single element the list always renders. Map your entries directly (as in the example) so the empty case is detectable.

  • No data-mol-id prop; styling resolves through getClassMap().

  • Node-valued props (title, actions, emptyState) arrive as a prop AND a same-named slot; components accept either.