npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-brackets

v2.4.0

Published

Headless, responsive tournament brackets for React.

Readme

react-brackets

Headless, responsive tournament brackets for React. Building for iOS or Android? Use @react-brackets/native, on the same core.

Documentation and live examples

  • Headless. Semantic markup with data-* hooks and no styles. Bring Tailwind, CSS modules, or the optional theme.
  • A bracket on every screen. On phones, swipe through the bracket one round at a time while it still looks like a bracket. Or keep the full tree with scroll, fit, or pan and zoom.
  • Accurate lines. Connectors are measured from your real match cards, so any card size, mirrored layout or right-to-left page just works.
  • Every format. Single and double elimination, two-sided brackets, round robin, Swiss and groups to playoffs, with seeding, byes, results and standings.
  • Small. No runtime dependencies besides React.

v2 is a ground-up rewrite. Upgrading from 0.x? Read the migration guide. v0.x lives on the legacy branch.

Install

npm install react-brackets @react-brackets/theme

Quick start

import { Bracket, singleElimination } from 'react-brackets';
import '@react-brackets/theme/theme.css';

const stage = singleElimination([
  { id: 'falcons', name: 'Falcons' },
  { id: 'wolves', name: 'Wolves' },
  { id: 'herons', name: 'Herons' },
  { id: 'lynx', name: 'Lynx' },
]);

export function App() {
  return <Bracket stage={stage} />;
}

Results

Stages are plain data. Report a result and get a new stage back, with the winner moved forward:

import { reportResult } from 'react-brackets';

const next = reportResult(stage, 'main.r1.m1', { scores: [3, 1] });
const live = reportResult(next, 'main.r1.m2', { scores: [1, 1], live: true });

Overturning a result clears everything that depended on it.

Formats

import {
  doubleElimination,
  nextSwissRound,
  qualifiers,
  roundRobin,
  singleElimination,
  standings,
  swiss,
} from 'react-brackets';

singleElimination(teams, { thirdPlace: true });
doubleElimination(teams, { grandFinal: 'reset' });
roundRobin(teams, { groups: 2, legs: 2 });
swiss(players, { rounds: 5 }); // then nextSwissRound(stage) after each round

standings(stage); // points, wins, draws, losses, score difference
singleElimination(qualifiers(groupStage, 2)); // A1 v B2, B1 v A2

Pass layout="mirrored" to <Bracket> for a two-sided bracket that meets in the middle.

Small screens

Below compactBelow (640px of container width by default) the bracket pages through one round at a time. The round in focus stacks tightly, the next one peeks in with its connectors, and swiping glides every match into place.

<Bracket stage={stage} />                    // swipeable bracket (default)
<Bracket stage={stage} compact="list" />     // swipeable lists of matches
<Bracket stage={stage} compactBelow={0} mode="fit" />       // the whole tree, scaled to fit
<Bracket stage={stage} compactBelow={0} mode="pan-zoom" />  // drag, pinch and zoom

Styling

Every element has data-scope="bracket" and a data-part, plus state attributes such as data-winner, data-loser, data-bye, data-status and data-highlighted.

Pass classes per part:

<Bracket
  stage={stage}
  classNames={{
    match: 'rounded-xl bg-white ring-1 ring-zinc-200 data-highlighted:ring-indigo-500',
    participant: 'flex justify-between px-3 py-2 data-winner:font-semibold',
    connector: 'stroke-zinc-300 data-highlighted:stroke-indigo-500',
  }}
/>;

Or use the theme and override its variables:

.my-bracket {
  --rb-accent: #c2410c;
  --rb-radius: 14px;
  --rb-match-width: 12rem;
}

The theme follows the page's color-scheme, so light and dark work without extra setup.

Composition

<Bracket> is a shortcut. Compose the parts yourself for full control:

<Bracket.Root stage={stage} layout="mirrored" onMatchClick={openMatch}>
  <Bracket.Viewport>
    <Bracket.Rounds>
      {() => (
        <Bracket.Round>
          <Bracket.RoundTitle />
          <Bracket.Matches>
            {(match) => (
              <Bracket.Match>
                <Bracket.Participant slot={0} />
                <Bracket.Participant slot={1} />
              </Bracket.Match>
            )}
          </Bracket.Matches>
        </Bracket.Round>
      )}
    </Bracket.Rounds>
    <Bracket.Connectors radius={8} />
  </Bracket.Viewport>
  <Bracket.Pagination />
</Bracket.Root>;

Server components

react-brackets is a client module. In a React Server Component, build the stage with @react-brackets/core and pass it down:

import { singleElimination } from '@react-brackets/core';
import { Bracket } from 'react-brackets';

export default function Page() {
  return <Bracket stage={singleElimination(teams)} />;
}

Packages

| Package | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | | react-brackets | Headless React components. Re-exports the core. | | @react-brackets/core | Formats, results and layout. No framework, no dependencies. | | @react-brackets/theme | Optional stylesheet driven by CSS variables. |

Examples

Run them all locally with bun install && bun run build && bun run examples. The source is in examples:

Contributing

The repo uses Bun workspaces and Biome.

bun install
bun run build
bun run test
bun run lint

Thanks

To everyone who used, reported and improved v0.x, and especially to Oliver Looney for keeping it alive.

License

MIT