Skip to content

Commit b830d44

Browse files
committed
docs: update getting started
1 parent fb48365 commit b830d44

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

content/guides/react/index.mdx

+24-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,31 @@ source: https://github.com/primer/react
99
1. Install `@primer/react` and its peer dependencies:
1010

1111
```bash
12-
npm install @primer/react react react-dom styled-components
12+
npm install @primer/react react react-dom styled-components @primer/primitives --save
1313
```
1414

15-
2. Wrap the root of your application with `ThemeProvider` and `BaseStyles`:
15+
2. Import and use `@primer/primitives` in your global CSS file
16+
17+
```css
18+
@import '@primer/primitives/dist/css/primitives.css';
19+
@import '@primer/primitives/dist/css/functional/themes/light.css';
20+
@import '@primer/primitives/dist/css/functional/themes/dark.css';
21+
22+
body {
23+
color: var(--fgColor-default);
24+
background-color: var(--bgColor-default);
25+
}
26+
```
27+
28+
3. Set the `data-color-mode`, `data-light-theme`, and `data-dark-theme` attributes on your `html` element. These will control the color mode and active theme for your application. To learn more about theming, check out our [theming guide](/guides/react/theming)
29+
30+
```html
31+
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark">
32+
<!-- ... -->
33+
</html>
34+
```
35+
36+
4. Wrap the root of your application with `ThemeProvider` and `BaseStyles`:
1637

1738
```jsx
1839
import {ThemeProvider, BaseStyles} from '@primer/react'
@@ -28,7 +49,7 @@ source: https://github.com/primer/react
2849
}
2950
```
3051

31-
3. Import components from `@primer/react` and use them in your application:
52+
5. Import components from `@primer/react` and use them in your application:
3253

3354
```jsx
3455
import {Button} from '@primer/react'

0 commit comments

Comments
 (0)