# @primer/react

> An implementation of GitHub's Primer Design System using React

Latest version **38.40.0** (published 2026-09-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @primer/react
pnpm add @primer/react
yarn add @primer/react
bun add @primer/react
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 38.40.0 |
| Published | 2026-09-18 |
| First published | 2021-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 18 |
| Unpacked size | 3.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3901 |
| Author | GitHub, Inc. |
| Maintainers | primer-css |
| Keywords | react, components, library, design-system |

## Links

- npm: https://www.npmjs.com/package/@primer/react
- Repository: https://github.com/primer/react
- Homepage: https://github.com/primer/react#readme
- Issues: https://github.com/primer/react/issues
- npm.io page: https://npm.io/package/@primer/react

## Dependencies (18)

- [clsx](https://npm.io/package/clsx.md) ^2.1.1
- [hsluv](https://npm.io/package/hsluv.md) 1.0.1
- [color2k](https://npm.io/package/color2k.md) ^2.0.3
- [history](https://npm.io/package/history.md) ^5.0.0
- [deepmerge](https://npm.io/package/deepmerge.md) ^4.3.1
- [focus-visible](https://npm.io/package/focus-visible.md) ^5.2.1
- [lodash.isempty](https://npm.io/package/lodash.isempty.md) ^4.4.0
- [@lit-labs/react](https://npm.io/package/@lit-labs/react.md) 1.2.1
- [lodash.isobject](https://npm.io/package/lodash.isobject.md) ^3.0.2
- [@primer/behaviors](https://npm.io/package/@primer/behaviors.md) ^1.10.3
- [@primer/primitives](https://npm.io/package/@primer/primitives.md) 10.x || 11.x
- [@github/mini-throttle](https://npm.io/package/@github/mini-throttle.md) ^2.1.1
- [@primer/octicons-react](https://npm.io/package/@primer/octicons-react.md) ^19.28.1
- [@tanstack/react-virtual](https://npm.io/package/@tanstack/react-virtual.md) ^3.13.18
- [@oddbird/popover-polyfill](https://npm.io/package/@oddbird/popover-polyfill.md) ^0.5.2
- [@primer/live-region-element](https://npm.io/package/@primer/live-region-element.md) ^0.8.0
- [react-intersection-observer](https://npm.io/package/react-intersection-observer.md) ^10.0.3
- [@github/relative-time-element](https://npm.io/package/@github/relative-time-element.md) ^5.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 38.40.0 (latest) — 2026-09-18
- 38.40.1-rc.e1840f86c (next) — 2026-09-18
- 0.0.0-20260915185318 (canary) — 2026-09-15
- 38.40.0-rc.e3c6a1460 — 2026-09-18
- 38.40.0-rc.d30f38719 — 2026-09-17
- 38.40.0-rc.37bd8a025 — 2026-09-16
- 38.40.0-rc.960078edf — 2026-09-16
- 0.0.0-20260915174622 — 2026-09-15
- 38.40.0-rc.d123ed540 — 2026-09-15
- 0.0.0-20260915162741 — 2026-09-15
- 38.40.0-rc.3ade0b294 — 2026-09-14
- 38.40.0-rc.c4e661038 — 2026-09-14
- 38.40.0-rc.f21a1e9b0 — 2026-09-14
- 38.40.0-rc.28e5764e2 — 2026-09-14
- 38.40.0-rc.629dc4f91 — 2026-09-11
- … 2373 more at https://npm.io/package/@primer/react/versions

## README

<p align="center">
  <img alt="Primer logo" width="300px" src="https://user-images.githubusercontent.com/4608155/127241386-f11da52d-00d9-4366-b01c-6f4c1ebcf7f2.png">
</p>

<h1 align="center">Primer React</h1>

<p align="center">A React implementation of GitHub's Primer Design System</p>

<p align="center">
  <a aria-label="npm package" href="https://www.npmjs.com/package/@primer/react">
    <img alt="npm package" src="https://img.shields.io/npm/v/@primer/react.svg">
  </a>
  <a aria-label="contributors graph" href="https://github.com/primer/react/graphs/contributors">
    <img alt="contributors graph" src="https://img.shields.io/github/contributors/primer/react.svg">
  </a>
  <a aria-label="last commit" href="https://github.com/primer/react/commits/main">
    <img alt="last commit" src=
  "https://img.shields.io/github/last-commit/primer/react.svg">
  </a>
  <a aria-label="license" href="https://github.com/primer/react/blob/main/LICENSE">
    <img alt="license" src="https://img.shields.io/github/license/primer/react.svg" alt="">
  </a>
</p>

## Getting started

To install `@primer/react` in your project, you will need to run the following
command using [npm](https://www.npmjs.com/):

```bash
npm install -S @primer/react @primer/primitives
```

If you prefer [Yarn](https://yarnpkg.com/), use the following command instead:

```bash
yarn add @primer/react @primer/primitives
```

This command will install two packages in your project:

- `@primer/react`: used to import and use all the components from Primer
- `@primer/primitives`: used to include the design tokens from Primer

To learn more about how to use `@primer/react`, visit our documentation site at:
[primer.style](https://primer.style).

## Usage

The `@primer/react` package provides components in React for the Primer Design System. To use a component, import it directly from the package:

```tsx
import {Button} from '@primer/react'

function App() {
  return <Button>Hello world</Button>
}
```

At the root of your application, you'll also want to include our
`BaseStyles` component along with styles from the
`@primer/primitives` package. For example:

```tsx
// Import each of the themes you would like to use, by default we are including
// the light theme below
import '@primer/primitives/dist/css/functional/themes/light.css'
import {BaseStyles} from '@primer/react'

function RootLayout() {
  return (
    <BaseStyles>
      <App />
    </BaseStyles>
  )
}
```

In addition, you will need to add the following attributes to your `html` element:

```html
<html data-light-theme="light" data-dark-theme="dark" data-color-mode="auto">
  <!-- ... -->
</html>
```

## 📖 Documentation

The documentation for `@primer/react` lives at [primer.style](https://primer.style). There, you'll find detailed documentation on getting started, all of the components, our theme, our principles, and more.

## 🙌 Contributing

We love collaborating with folks inside and outside of GitHub and welcome contributions! If you're interested, check out our [contributing docs](contributor-docs/CONTRIBUTING.md) for more info on how to get started.

---
_Source: https://npm.io/package/@primer/react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
