Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # @emotion/cache
  2. ### createCache
  3. `createCache` allows for low level customization of how styles get inserted by emotion. It's intended to be used with the [`<CacheProvider/>`](https://emotion.sh/docs/cache-provider) component to override the default cache, which is created with sensible defaults for most applications.
  4. ```javascript
  5. import createCache from '@emotion/cache'
  6. export const myCache = createCache({
  7. key: 'my-prefix-key',
  8. stylisPlugins: [
  9. /* your plugins here */
  10. ]
  11. })
  12. ```
  13. ### Primary use cases
  14. - Using emotion in embedded contexts such as an `<iframe/>`
  15. - Setting a [nonce](#nonce-string) on any `<style/>` tag emotion creates for security purposes
  16. - Using emotion with a developer defined `<style/>` tag
  17. - Using emotion with custom Stylis plugins
  18. ## Options
  19. ### `nonce`
  20. `string`
  21. A nonce that will be set on each style tag that emotion inserts for [Content Security Policies](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP).
  22. ### `stylisPlugins`
  23. `Function` | `Array<Function>`
  24. A Stylis plugin or plugins that will be run by Stylis during preprocessing. [Read the Stylis docs to find out more](https://github.com/thysultan/stylis.js#plugins). This can be used for many purposes such as RTL.
  25. ### `prefix`
  26. `boolean` | `Function`, defaults to `true`
  27. Allows changing Stylis's vendor prefixing settings. It can be a boolean or a function to dynamically set which properties are prefixed. [More information can be found in the Stylis docs](https://github.com/thysultan/stylis.js#vendor-prefixing).
  28. ### `key`
  29. `string`, defaults to `"css"`
  30. The prefix before class names. It will also be set as the value of the `data-emotion` attribute on the style tags that emotion inserts and it's used in the attribute name that marks style elements in `renderStylesToString` and `renderStylesToNodeStream`. This is **required if using multiple emotion caches in the same app**.
  31. ### `container`
  32. `HTMLElement`
  33. A DOM node that emotion will insert all of its style tags into. This is useful for inserting styles into iframes.