Skip to main content
Not yet released. The packages on this page are not published to npm yet, so the install commands below will not resolve. The documented interface is stable and the code exists; only publication is outstanding. To use KeyStone from a frontend today, call the REST API or the TypeScript SDK, which is published. Contact us if you need early access.
This guide walks through building a fully functional settlement dashboard with state filtering, color-coded badges, and pagination using @keystoneos/react hooks.

Prerequisites

  • @keystoneos/react installed
  • KeystoneProvider configured with a valid session token (see Getting Started)
  • A React project with TypeScript

What you will build

A settlement list page with:
  • A table showing reference, state, parties, asset/payment amounts, and creation date
  • Color-coded state badges
  • A dropdown filter for settlement states
  • Previous/next pagination with total count
  • Click-to-detail navigation

Setting up the provider

Before building the dashboard component, make sure your app is wrapped in KeystoneProvider with a session token from your backend. The token needs settlements:read scope at minimum.

Building the state badge

The getStateInfo utility returns display metadata for each settlement state, including a human-readable label and a semantic category you can map to colors.
The getStateInfo function maps states to categories:

Building the state filter

Create a dropdown that filters settlements by state. Passing undefined fetches all states.

Building pagination controls

The complete dashboard

This is the full working component that ties everything together.

What the data looks like

Here is an example of what a row renders with realistic data:

Adding click-to-detail navigation

The table rows are already clickable (using window.location.href). In a real application, use your router’s navigation method:

Next steps

Real-time Tracking

Build a detail view with live state updates and event timelines.

Submitting Instructions

Create settlements by submitting paired instructions.

useSettlements Reference

Full API reference for the useSettlements hook.

State Machine

Understand the settlement state machine and transitions.