# DataClient: leaderboard() method

> The leaderboard() method of the DataClient interface returns one of the project's leaderboards.

The **`leaderboard()`** method of the [`DataClient`](/docs/client/data-client) interface returns one of the project's leaderboards: a collection declared with leaderboard settings in `irt.config.ts`.

## Syntax

```ts
leaderboard(name)
```

### Parameters

`name`
: A string: the leaderboard's name.

### Return value

A [`ClientLeaderboard`](/docs/client/client-leaderboard).

### Exceptions

None. Its calls reject with a [`DataError`](/docs/room/data-error); `E_UNKNOWN` means the board isn't declared in the live build or isn't a leaderboard.

## Description

Reading a board needs its `clientRead: true`, and submitting a score its `clientWrite: "own"`. The board's periods, ranks and `keep` rule are as the Room API's [`Leaderboard`](/docs/room/leaderboard#description) describes.

## Examples

### Showing the player's rank

After a run, the client shows the player's rank this week and the two players either side.

```ts
// my-rank.ts
import { dataClient } from "@irtio/client";

const laps = dataClient().leaderboard("laps");

export async function showRank() {
  const near = await laps.around({ period: "week" });
  if (!near) console.log("no lap this week yet");
  else for (const e of near.entries) console.log(`${e.rank}. ${e.player} ${e.score} ms`);
}
```

## See also

- [`ClientLeaderboard`](/docs/client/client-leaderboard)
- [`RoomClient.leaderboard()`](/docs/client/room-client/leaderboard), the same from a connected client
- [Player data, collections and leaderboards](/docs/room/guides/player-data#from-a-client)
