# Leaderboard: top() method

> The top() method of the Leaderboard interface resolves with a page of the best entries of a period.

The **`top()`** method of the [`Leaderboard`](/docs/room/leaderboard) interface resolves with a page of the best entries of a period, best first.

## Syntax

```ts
top()
top(options)
```

### Parameters

`options` Optional
: An object with any of these properties:

  `period`
  : The period, as the [`Leaderboard`](/docs/room/leaderboard#description) page describes. Defaults to `"all"`.

  `limit`
  : The most entries in the page, from 1 to 100. Defaults to 20.

  `after`
  : The `next` of the page before, for the page after it.

### Return value

A `Promise` that resolves with `{ entries, next }`. `next` is `null` on the last page. Each entry is an object with these properties:

`rank`
: Its rank, from 1.

`player`
: The player's ID.

`score`
: The score the period keeps for the player.

`meta`
: The `meta` the last submit gave.

`updated`
: When the entry was last written, in wall-clock milliseconds.

### Exceptions

The promise rejects with a [`DataError`](/docs/room/data-error).

## Description

`top()` is never cached, so call it on an event or every few seconds rather than every tick.

## Examples

### Showing today's top ten in the lobby

```ts
// daily.ts
import { defineRoom } from "@irtio/room";

export default defineRoom({
  async onJoin(room, connection) {
    const { entries } = await room.leaderboard("points").top({ period: "day", limit: 10 });
    room.send(connection, { type: "today", top: entries.map((e) => ({ rank: e.rank, player: e.player, score: e.score })) });
  },
});
```

## See also

- [`Leaderboard.around()`](/docs/room/leaderboard/around)
