Knockout Wheel

A tournament drawn in rings, with the champion at the center.

Contributed by Avinit(opens in a new tab)

Preview

"use client";

import { KnockoutWheel, ROUNDS } from "@/components/motion/knockout-wheel";

// `ROUNDS` is the sample 32-team cup that ships with the component, and it's the
// same array the knockout bracket takes, so one dataset feeds both fixture
// styles. Any other single-elimination tournament renders the same way. Build
// your own `Round[]`, widest round first, each round holding half the matches of
// the one before it, and pass it in:
//
//   const rounds: Round[] = [
//     {
//       name: "Quarter-finals",
//       matches: [
//         {
//           id: "qf-1",
//           home: { team: { name: "Cloud9", logo: "/logos/c9.svg" }, score: 2 },
//           away: { team: { name: "T1", logo: "/logos/t1.svg" }, score: 1 },
//           winner: "home",
//         },
//         // qf-2, qf-3, qf-4 …
//       ],
//     },
//     { name: "Semi-finals", matches: [/* fed by qf 1+2 and qf 3+4 */] },
//     { name: "Grand final", matches: [/* the one final */] },
//   ];
//
// The wheel grows a ring per round and holds a 32rem stage at every size, so it
// pans on a phone rather than shrinking its marks. A team carries a `logo` URL,
// an ISO country `code` for a flag, or neither, in which case its initials stand
// in. `initialRound` drops the outer rounds.
export function KnockoutWheelPreview() {
  return (
    <div className="w-full py-8">
      <KnockoutWheel rounds={ROUNDS} />
    </div>
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/knockout-wheel

API Reference

rounds
Round[]

The whole draw, ordered widest round first — the same array the knockout bracket takes. Any single-elimination tournament fits: each round holds half the matches of the one before it (16 → 8 → 4 → 2 → 1) and `rounds[r].matches[k]` is fed by matches `2k` and `2k + 1` of the round before it. Two rounds are enough; the wheel grows a ring per round and sizes itself to the rim.

Default—
initialRound?
number

Index of the outermost round to draw. Earlier rounds are dropped and the kept round's own teams become the rim, so `1` on a 32-team draw opens at the Round of 16. Defaults to 0 (the whole tree); clamped to the valid range.

Default0
className?
string

Classes merged onto the root scroll container.

Default—
labels?
Partial<{ label: string; labelWithChampion: string; tbd: string; versus: string; result: string; resultPenalties: string; caption: string; }>

Override any built-in string.

Default—

More in Fixtures

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.

Updated