HatchedDocs
ReferenceWidgets

Leaderboard widget

A ranked list scoped to time window, audience, or group.

Mount

<div
  data-hatched-widget="leaderboard"
  data-hatched-token="SESSION_OR_EMBED_TOKEN"
  data-hatched-leaderboard-id="lb_weekly"
></div>

Attributes

AttributeValuesDefault
data-hatched-tokensession or embed tokenrequired
data-hatched-leaderboard-idleaderboard idrequired
data-hatched-visibilityfull neighborhoodneighborhood
data-hatched-highlight-selftrue falsetrue
data-hatched-limitnumber10
data-hatched-group-idid stringoptional

Visibility modes

  • full — the entire ranked list, up to limit entries.
  • neighborhood — the buddy's own rank ±N entries. Less demotivating for mid/low ranks.

Required scopes

  • leaderboards:read
  • buddy:read (to highlight self)

Events

el.addEventListener('hatched:rank-changed', (e) => {
  console.log('new rank', e.detail.rank);
});

Refresh cadence

Leaderboards are snapshotted every 10 minutes by default. The widget auto-refreshes on a matching cadence. For lower-latency surfaces, dial data-hatched-refresh-ms="60000" — it still respects the server-side snapshot window, so this only determines when the widget fetches.