@@ -4,34 +4,34 @@ title: 'Global Styles'
44
55# Global Styles
66
7- Use the Emotion ` Global ` component to add global CSS with theme-based values.
7+ Theme UI offers a ` Global ` component (that wraps Emotion’s) for adding global
8+ CSS with theme-based values.
89
9- By default, the ` ThemeProvider ` component will apply styles in ` theme.styles.root ` to the ` <html> ` element.
10- It will also apply ` color ` and ` background-color ` styles based on ` theme.colors.text ` and ` theme.colors.background ` respectively.
10+ By default (or, unless the
11+ [ ` useRootStyles ` configuration option] ( /theming#configuration-flags ) is
12+ disabled), the ` ThemeProvider ` component will apply styles in
13+ ` theme.styles.root ` to the ` <html> ` element. It will also apply ` color ` and
14+ ` background-color ` styles based on ` theme.colors.text ` and
15+ ` theme.colors.background ` respectively.
1116
1217<Note >
1318 Generally, you should try to avoid adding CSS to global scope. Many styles can
1419 be safely encapsulated into a component without the need for global styles.
1520</Note >
1621
1722``` jsx
18- import { Global } from ' @emotion/react '
23+ import { Global } from ' theme-ui '
1924
2025export default (props ) => (
2126 < Global
22- styles= {(theme ) => ({
23- ' *' : {
24- boxSizing: ' border-box' ,
27+ styles= {{
28+ button: {
29+ m: 0 ,
30+ bg: ' primary' ,
31+ color: ' background' ,
32+ border: 0 ,
2533 },
26- }) }
34+ }}
2735 / >
2836)
2937```
30-
31- <Note >
32-
33- If you are upgrading from a version of theme-ui older that v0.6.0, be aware the import
34- package has changed from ` @emotion/core ` to ` @emotion/react ` . For more information see
35- the [ Migration Notes for 0.6] ( https://theme-ui.com/migrating/#breaking-changes ) .
36-
37- </Note >
0 commit comments