Library / SDK
primer/react avatar
primer/react

Primer React: GitHub's design system as a React component library

An implementation of GitHub's Primer Design System using React

3,906 stars682 forksTypeScriptMIT

At a glance

What is it?
Primer React packages GitHub's Primer design system into installable React components. It suits teams that want GitHub's interface patterns without rebuilding them, and it is a poor fit for anyone who wants a small, unopinionated set of primitives.
Who is it for?
Adopt Primer React if you are building a GitHub-adjacent product or an internal tool where matching GitHub's interface conventions is a feature rather than a constraint. Do not adopt it if you need a headless, unstyled primitive layer or you cannot accept GitHub's visual language as your own.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 4 days ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 27, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What Primer React is, and the problem it removes

Primer React is a React implementation of GitHub's Primer Design System, published to npm as @primer/react. The problem it addresses is not "how do I render a button in React". It is "how do I render a button that behaves and looks the way GitHub's buttons do, including states, spacing and accessibility wiring, without reimplementing that from scratch". The README states the scope plainly: it is a React implementation of GitHub's Primer Design System, and the documentation site at primer.style/react covers getting started, the components, the theme and the principles.

The intended audience is narrow and worth stating. The repository's contributing notes say new component proposals are welcome from internal GitHub teams, and that the project's best work comes from collaborating with the teams using the components. That is a signal about who the library is optimised for. Outside teams can and do consume the npm package, but the component roadmap is shaped by GitHub's own product needs. If your interface requirements diverge from GitHub's, you will feel that.

How the monorepo and the published package relate

The repository is a private npm workspace root named primer, with workspaces declared for packages/rolldown-plugin-import-css, packages/react, packages/mcp, packages/* and examples/*. The published artifact is the package inside packages/react; everything else in the tree exists to build, document, test or demonstrate it. The root package.json is private, so you cannot install the repository root as a dependency.

The build is orchestrated with turbo. The root build script runs turbo run build with a filter that excludes the examples workspaces, and there is a separate type-check script that runs tsc --noEmit before delegating to turbo across packages. Storybook is started through a workspace script, and the docs site is built by a script under script/. For a consumer this matters only in one way: the thing you install is a compiled package with its own release cadence, not the repository. Releases are cut through changesets, and the presence of a .changeset directory plus a release script that runs the build and then changeset publish tells you the release process is automated rather than hand-tagged.

The cadence is visible in the release list. @primer/[email protected] was published on 2026-09-18, 38.39.0 on 2026-09-11, and 38.38.0 on 2026-09-03. Weekly minor bumps on a 38.x line mean you should expect to move your dependency version deliberately rather than pin and forget.

Installing @primer/react and rendering a first component

The README gives two install commands, one per package manager. Pick the one that matches your project's lockfile.

bash
npm install @primer/react
bash
yarn add @primer/react

After the install finishes, @primer/react appears in your dependencies and the package's components become importable in your React code. The README does not spell out a provider or theme setup step, so treat the documentation site as the source for anything beyond the install itself.

The README also points at a react template repository, described as the fastest way to make a prototype or try Primer React without setting up a new project. That is the lower-friction path if you want to see the components rendered before you commit to wiring them into an existing app. The repository additionally ships example directories under examples/, including examples/nextjs, examples/theming and examples/codesandbox, which show the library used inside real project setups rather than in isolation.

If you are evaluating rather than adopting, clone the repository and run the setup and Storybook scripts from the root package.json. The setup script is ./script/setup and Storybook starts through the workspace script. That gives you the full component set in a browser without touching your own application.

Where Primer React is the wrong choice

The clearest limitation is stylistic coupling. Primer React implements GitHub's design system. Adopting it means adopting GitHub's visual language, and the theme and principles documentation exists precisely because that language is opinionated. If your product has its own brand system, you are not choosing a component library, you are choosing someone else's design decisions and then working against them.

A second constraint is the version line. The current releases sit on 38.x with weekly minor bumps. That is a fast-moving dependency for a design system, and the repository's own tooling reflects the cost: there is a migrating.md file at the top level, and the changelog is maintained separately. A migration guide existing at the repository root is not a defect, but it does tell you upgrades are expected to require attention rather than being drop-in.

A third point is that the repository is a monorepo with a private root. You cannot vendor the whole thing as one dependency, and the internal packages (the rolldown CSS import plugin, the mcp package) are separate concerns from the React components. Teams that want a single vendored tree will find the workspace layout inconvenient.

Finally, the contributing documentation is explicit that component proposals are welcomed from internal GitHub teams. That does not prevent outside contributions, and the README says contributions from outside GitHub are welcome, but it does mean the component set tracks GitHub's product surface. If you need a component GitHub has no use for, you are building it yourself on top of the library's primitives.

Primer React compared with headless component libraries

The natural alternative for a team with its own design language is a headless or unstyled primitive library, where you get behaviour, focus management and accessibility semantics but supply all the visual styling. The difference in approach is total. A headless library gives you a menu that opens and closes correctly and lets you decide what it looks like. Primer React gives you a menu that opens, closes and looks like GitHub's menu, with GitHub's spacing, colour and typography baked in through the Primer theme.

The trade-off runs in both directions. With a headless library you write more CSS and own the accessibility details of your visual layer. With Primer React you write less and inherit decisions you did not make. Neither is universally better. The deciding question is whether matching GitHub's interface is a requirement or an accident. If it is a requirement, Primer React is doing work you would otherwise do badly. If it is an accident, you will spend your time overriding a theme instead of building a product.

A middle option visible in the repository is examples/theming, which shows the theming path rather than a full replacement of the component layer.

Licence, maintenance and what an upgrade actually costs

The licence is MIT, and the README links to the LICENSE file at the repository root. MIT is permissive: it allows commercial use, modification and redistribution, and it requires that the copyright notice and permission notice be preserved. That is the extent of what the repository states. Nothing in the README or the repository layout suggests dual licensing, a commercial tier or a contributor licence agreement that changes the terms for consumers. For anything beyond that, read the LICENSE file itself rather than a summary.

The repository is not archived, and the last push was on 2026-09-23. Combined with releases on 2026-09-18, 2026-09-11 and 2026-09-03, the project is being pushed to and published on a weekly rhythm. Maintenance is not the risk here.

The upgrade cost is the real one. A design system on a 38.x line with weekly minor releases will occasionally change rendered output, and the presence of migrating.md at the root is the project's own acknowledgement that some changes need a migration step. Budget for reading the changelog on each bump rather than treating the dependency as inert. The repository also carries a changeset directory, which is where individual releases are described before they are published, so that is the earliest place to see what is coming.

What a first evaluation should check

Start from the documentation site rather than the README, because the README is deliberately short and defers to primer.style/react for component-level detail, theming and principles. The README's own framing is that the site is where you find "detailed documentation on getting started, all of the components, our theme, our principles, and more".

Then check the two things the README cannot tell you. First, whether the components you actually need exist in the current 38.x line, since the component set is shaped by GitHub's product surface. Second, whether the theming path in examples/theming can accommodate your brand without fighting it. Those two checks decide the adoption question far more than any benchmark would.

If both pass, the install is a single command and the template repository gives you a running prototype without a project setup.

Editorial conclusion

Adopt Primer React if you are building a GitHub-adjacent product or an internal tool where matching GitHub's interface conventions is a feature rather than a constraint. Do not adopt it if you need a headless, unstyled primitive layer or you cannot accept GitHub's visual language as your own. Before committing, install @primer/react in a branch, render a couple of components from the docs site, and check the CHANGELOG.md and the .changeset directory to see how often the published package moves.

Frequently asked questions

What is Primer React used for?

It is a React implementation of GitHub's Primer Design System, so it is used to build React interfaces that follow GitHub's component patterns, theme and principles. The documentation site covers the components, theming and principles in detail.

How do I install Primer React?

The README gives two commands: npm install @primer/react, or yarn add @primer/react if you use Yarn. The README does not document any additional setup step beyond the install.

Can I use Primer React for free?

Yes. The repository is licensed under MIT, which permits commercial use, modification and redistribution provided the copyright and permission notices are preserved. The README links to the LICENSE file at the repository root for the full text.

Official sources

  1. License: MIT
  2. primer/react on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/primer-react.svg)](https://hysenlabs.com/projects/primer-react)