React
Get started using Primer React components in your React application.
Install @primer/react
and its peer dependencies:
npm install @primer/react react react-dom styled-components
Wrap the root of your application with ThemeProvider
and BaseStyles
:
import {ThemeProvider, BaseStyles} from '@primer/react'function App() {return (<ThemeProvider><BaseStyles><div>...</div></BaseStyles></ThemeProvider>)}
Import components from @primer/react
and use them in your application:
import {Button} from '@primer/react'function MyComponent() {return <Button>Click me</Button>}
See the primer/react repository for more information about how to use and contribute to Primer React. For component-specific documentation, check out the React section of component guidelines (example: ActionList).