Primer by GitHub
🍀 Directory Note
"The developer-tool reference: GitHub's own system, with React, CSS, and Rails implementations sharing one token source and nine shipped color themes, in exchange for shipping GitHub's visual identity."
About Primer by GitHub
Primer is GitHub's design system, documented at primer.style, and the system behind GitHub.com. It is not a single library: the same design language ships as Primer React (@primer/react on npm, version 38.42.0, checked October 2026), Primer CSS (@primer/css, version 22.3.2), and Primer ViewComponents, a Ruby gem of ViewComponent components for Rails applications, the framework GitHub itself extracted from its own codebase. Icons are a separate piece of the system: Octicons, GitHub's icon set, published for React as @primer/octicons-react (version 19.41.0), with usage rules in the Primer documentation covering predefined icon pairs, accessible names for meaningful icons, and a 3:1 contrast minimum for icons that convey meaning.Tokens are the shared layer, and they live in one package: @primer/primitives (version 11.10.0) is described by the project as the single source of truth for color, typography, and spacing. Primer delivers tokens as CSS variables for code and Figma variables for design, through the Primer Web Figma library, grouped into base, functional, and pattern tokens. GitHub's interface offers light and dark color modes, and Primer supports both modes across nine themes, including colorblind variants (protanopia and deuteranopia, and tritanopia), high-contrast variants, and a dark dimmed theme. The React setup is explicit about its pieces: install @primer/react together with @primer/primitives and React 18 or 19, wrap the application root in ThemeProvider and BaseStyles, and import the theme stylesheet you want from @primer/primitives. That minimal setup is not the whole GitHub look: matching GitHub.com base styling takes a separate import of the complete @primer/css bundle, and rendered markdown needs the markdown-body class. Primer React ships its own TypeScript typings and supports the current versions of Chrome, Firefox, Safari, and Microsoft Edge, plus Firefox ESR, matching GitHub's own browser support.The trade-off to weigh is identity. Primer's components, spacing, and color tokens are GitHub's product language, so a product built on Primer will look like a GitHub product unless it is re-themed with real effort. That is a feature when the audience is developers who already live in GitHub, and a cost everywhere else.
Primary Use Cases
- 1Developer Tools and IDEs
- 2Documentation and Wikis
- 3Code Hosting and Management
- 4CLI and Terminal dashboards
- 5Products that want a GitHub-adjacent developer experience
Technical Data
Guidelines
primer.style (getting started for React, foundations including color usage, per-component documentation with accessibility notes, Octicons usage guidelines)
React implementation
@primer/react on npm (version 38.42.0, checked October 2026), MIT; GitHub's Primer Design System implemented in React, with its own TypeScript typings; @primer/primitives 10.x or 11.x is a package dependency and React 18 or 19 is the peer dependency (npm registry, checked October 2026)
Setup
npm install @primer/react @primer/primitives react react-dom; wrap the app root in ThemeProvider and BaseStyles and import a theme stylesheet from @primer/primitives; import the complete @primer/css bundle for GitHub.com base styling and use the markdown-body class for rendered markdown
CSS implementation
@primer/css on npm (version 22.3.2, checked October 2026), MIT; the CSS implementation of the Primer Design System
Rails implementation
Primer ViewComponents, a Ruby gem of ViewComponent components for the Primer Design System; the ViewComponent framework itself was extracted from GitHub.com
Tokens
@primer/primitives on npm (version 11.10.0, checked October 2026), MIT; the single source of truth for color, typography, and spacing tokens, delivered as CSS variables for code and Figma variables for design via the Primer Web Figma library, grouped into base, functional, and pattern tokens
Themes
Two color modes, light and dark, across nine themes, including colorblind variants (protanopia and deuteranopia, and tritanopia), high-contrast variants, and dark dimmed
Icons
Octicons, GitHub's icon set, published for React as @primer/octicons-react (version 19.41.0, checked October 2026), MIT; the usage guidelines require predefined icon pairs, an accessible name for icons that convey meaning, and at least 3:1 contrast for meaningful icons
Browser support
Primer React supports the current versions of Chrome, Firefox, Safari, and Microsoft Edge, plus Firefox ESR, consistent with GitHub's browser support; it does not transform code for older ECMAScript versions
License
MIT across the published packages (@primer/react, @primer/css, @primer/primitives, @primer/octicons-react; npm registry, checked October 2026)
Editorial review
Primer is the rare house system whose production proof is public and enormous: it is the system GitHub.com itself runs on, maintained in the open, with the documentation, the components, and the tokens all published. The interesting question for an outside team is not whether it works, but what adopting it commits you to.
Three implementations, one token source Most systems in this directory are one library with guidelines around it. Primer is three implementations of one language: Primer React for React applications, Primer CSS for framework-free use, and Primer ViewComponents for Rails, which exists because GitHub's own stack needed components in Ruby and the ViewComponent framework was extracted from GitHub.com to provide them. What holds the three together is @primer/primitives, the token package the project calls its single source of truth for color, typography, and spacing. The same tokens are exposed as CSS variables in code and as Figma variables in the Primer Web Figma library, so the design-to-code token story is one artefact, not two synchronised ones. The React setup shows the shape plainly: primitives is a peer dependency with a floor version, the theme arrives as an imported stylesheet from that package, and ThemeProvider plus BaseStyles sit at the root.
Nine themes is the accessibility story Primer's color system ships light and dark modes across nine themes, and the list is the point: alongside the standard light and dark there are colorblind themes for protanopia and deuteranopia and for tritanopia, high-contrast variants, and a dark dimmed theme. A team adopting Primer gets accessible color modes as shipped configuration, where most systems leave dark mode as an exercise and colorblind support as a wish. The same seriousness shows in the details: component documentation carries per-component accessibility notes (the Pagination page, for example, specifies focus management, accessible names, and target sizes), and the Octicons guidelines are rules rather than vibes: use the predefined icon pairs, give meaningful icons an accessible name or they are treated as decorative, and keep meaningful icons at 3:1 contrast or better.
The honest costs Three of them. First, identity: Primer looks like GitHub because it is GitHub, and an unrelated product built on it will be read as a GitHub lookalike unless the team invests in re-theming at the token level. Second, the GitHub look is opt-in in layers: the documented minimal React setup deliberately does not include the full GitHub.com base styling, which is a separate @primer/css import, and markdown needs the markdown-body class, so "make it look exactly like GitHub" is a decision to make on purpose, not the default outcome. Third, the reach is web-only in the documented paths: React, CSS, and Rails cover most developer-tool surfaces, but a team that also ships native mobile applications will run a second system beside Primer, because there is no native library in its getting-started paths.
For a developer-facing product whose users already spend their day in GitHub, those costs are close to free and the theme and token story is a strong fit. For a consumer brand, the same facts argue the other way. That clarity about who it is for is itself a sign of a mature system.
Directory Analysis & Suitability
Key Advantages
- One token source (@primer/primitives) feeds the React, CSS, and Rails ViewComponents implementations, and the same tokens exist as Figma variables for designers
- Nine shipped themes across light and dark modes, including colorblind and high-contrast variants, so accessible theming is a configuration choice rather than a separate project
- Accessibility is documented per component, and the Octicons rules are concrete: predefined icon pairs, an accessible name for meaningful icons, and a 3:1 contrast minimum
Considerations
- The visual identity is GitHub's: an unrelated product built on Primer reads as a GitHub lookalike unless it is re-themed heavily
- The full GitHub.com styling is a separate opt-in (@primer/css) on top of the minimal React setup, so matching GitHub exactly is a deliberate second step, not the default
- The implementations are web stacks (React, CSS, Rails ViewComponents); there is no native mobile library in the documented getting-started paths
Platform Compatibility
Web Environment
Primary surface, three ways in: Primer React (@primer/react, React 18 or 19, TypeScript typings included), Primer CSS (@primer/css) for framework-free use, and Primer ViewComponents for Rails applications.
Mobile & Touch
No native library in the documented getting-started paths; mobile web uses the React or CSS implementations.
Desktop Software
Desktop web applications use the same React or CSS implementations; Primer is the system behind GitHub.com and GitHub's web product surfaces.