mirror of
https://github.com/emotion-js/emotion.git
synced 2026-02-01 17:20:42 +00:00
* WIP codemod for renaming * Lockfile changes * emotion -> @emotion/css * core -> react * Server stuff * Move removed packages to another directory * More things * More things * Some more things * Rename ESLint plugin * Change name in @emotion/eslint-plugin CHANGELOG.md * Jest package and Babel plugin renmaes * Things * Update eslint plugin migration error message * Formatting things * Fix some things * Upgrade babel-eslint * Add @emotion/pkg-renaming rule to ESLint config and run it * Update existing changesets * Add some changesets * Update removed-packages/create-emotion/src/index.js Co-Authored-By: Mateusz Burzyński <mateuszburzynski@gmail.com> * Update removed-packages/emotion/macro.js Co-Authored-By: Mateusz Burzyński <mateuszburzynski@gmail.com> * Update removed-packages/eslint-plugin-emotion/src/index.js Co-Authored-By: Mateusz Burzyński <mateuszburzynski@gmail.com> * Update CodeSandbox CI config * Fix some things * Fix more things * Fix some stuff * Fix some more things * More fixes * Some things * Various updates for babel plugin * Fix more things * Fix another thing * Things * More stuff * Bad linting rules. * More things * More changes * Fix all the babel plugin stuff * Test the Babel plugin in dist tests because it's built now * Fix docs site building maybe * Update some snapshots * Fix some more things * Hopefully actually fix it this time * Replace @emotion/core with @emotion/react in a bunch of places * Fix TS types for @emotion/server/create-instance * Update snapshots * Disable a TSLint rule * More changesets * Docs and things * Fix more things * Fix a thing * Add a test:typescript script * Use glob in CodeSandbox CI config * Fix a thing * Fix TS things * ESLint plugin things * Fix some things * Fix @emotion/server pkg.json syntax error * Update docs/package-summary.mdx Co-Authored-By: Mateusz Burzyński <mateuszburzynski@gmail.com> * Fix some things * Add docs for creating instances of @emotion/css * Fix some little things * Comment out a test * Fix some little things * ts@next.......... Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
32 lines
757 B
Plaintext
32 lines
757 B
Plaintext
---
|
|
title: 'Global Styles'
|
|
---
|
|
|
|
Sometimes you might want to insert global css like resets or font faces. You can use the `Global` component to do this. It accepts a `styles` prop which accepts the same values as the `css` prop except it inserts styles globally. Global styles are also removed when the styles change or when the Global component unmounts.
|
|
|
|
```jsx
|
|
// @live
|
|
import { Global, css } from '@emotion/react'
|
|
|
|
render(
|
|
<div>
|
|
<Global
|
|
styles={css`
|
|
.some-class {
|
|
color: hotpink !important;
|
|
}
|
|
`}
|
|
/>
|
|
<Global
|
|
styles={{
|
|
'.some-class': {
|
|
fontSize: 50,
|
|
textAlign: 'center'
|
|
}
|
|
}}
|
|
/>
|
|
<div className="some-class">This is hotpink now!</div>
|
|
</div>
|
|
)
|
|
```
|