PitchKit

Introduction

What PitchKit is, and how the pieces fit together.

PitchKit is a React-first football pitch visualisation library for the web — mplsoccer's surface, built for the browser. @pitchkit/core is a framework-agnostic engine (coordinate transforms, geometry and the scene model); @pitchkit/react is the officially supported renderer, a set of declarative bindings on top of it, in three families: components (the pitch itself), overlays (data plotted onto it) and charts (football data with no pitch under it).

Install

npm install @pitchkit/core @pitchkit/react

The smallest thing that works

"use client";

import { Pitch, Scatter } from "@pitchkit/react";

const shots = [
  { x: 108, y: 38, xg: 0.62 },
  { x: 96, y: 48, xg: 0.15 },
];

export function ShotMap() {
  return (
    <Pitch type="statsbomb">
      <Scatter data={shots} x={(s) => s.x} y={(s) => s.y} r={(s) => 3 + s.xg * 9} />
    </Pitch>
  );
}

That's a responsive, server-renderable shot map. Every layer takes plain data plus accessor functions for its visual properties — x, y, and most other props accept either a static value or a per-datum function, which is how PitchKit stays shape-agnostic across providers (StatsBomb, Opta, UEFA, or your own).

For the same thing built up step by step against a real match — loading the Euro 2024 final, finding the move that produced England's goal, and plotting it — start with the Quickstart.

Finding your way around

Reading these docs with an AI agent

Models don't reliably know PitchKit's API, so anything an agent "remembers" about it may be invented. Three ways to give it the real thing, cheapest first:

  • /llms.txt — an index of every page on this site, in the llms.txt format. Paste the URL into a prompt.
  • /llms-full.txt — every guide, component and overlay page as one Markdown document, examples inlined. Small enough to hand over whole. The generated API reference is kept separate as /llms-api.txt so it doesn't crowd out the prose.
  • The Agent Skill — the best option if you're already installing the package, because it's versioned with the code rather than scraped from here.

Any page on this site is also available as raw Markdown: append .md to its URL (for example /docs/styling/theming.md).

On this page