| title | Getting started | ||||
|---|---|---|---|---|---|
| description | Primer Brand is open-sourced on GitHub and available on npm. | ||||
| menu-position | 1 | ||||
| keywords |
|
||||
| show-tabs | true | ||||
| tab-label | Default |
Primer Brand is open-sourced on GitHub and available on npm.
Install Primer Brand with npm.
npm install @primer/react-brandPrimer Brand requires a global stylesheet to be loaded ahead-of-time.
Refer to [this separate guide if you are using an ESM-compatible bundler](./esm.mdx). Component styles are included with the React component imports.Import the main stylesheet at the earliest rendering opportunity:
import '@primer/react-brand/lib/css/main.css'or
Load the static stylesheet if you're unable to import stylesheets using a bundler
<link href="https://unpkg.com/browse/@primer/react-brand@<version>/lib/css/main.css" rel="stylesheet" />Primer Brand references the Mona Sans typeface, which will need to be loaded alongside the main stylesheet.
import '@primer/react-brand/fonts/fonts.css'or
<link href="https://unpkg.com/browse/@primer/react-brand@<version>/fonts/fonts.css" rel="stylesheet" />You must add the ThemeProvider to the root of your application for theming to work correctly.
E.g.
import {ThemeProvider} from '@primer/react-brand'
function App() {
return (
<ThemeProvider>
<div>...</div>
</ThemeProvider>
)
}Components can be imported into any React-based application.
E.g.
import {Button, Hero} from '@primer/react-brand'<Hero>
<Hero.Label>Label</Hero.Label>
<Hero.Heading>This is my super sweet hero heading</Hero.Heading>
<Hero.Description>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien sit ullamcorper id. Aliquam luctus sed turpis
felis nam pulvinar risus elementum.
</Hero.Description>
<Hero.ButtonGroup>
<Button as="a" href="#">
Primary action
</Button>
<Button as="a" href="#" variant="secondary">
Secondary action
</Button>
</Hero.ButtonGroup>
</Hero>