emotion v10.0.0 Release Notes
Release Date: 2018-10-27 // over 5 years ago-
๐ Emotion 10 is a big change that we're really excited about with improvements to the css prop, a Global component for dynamic global styles, zero config SSR, lots of small fixes and improvements and more with an incremental adoption strategy. For a higher-level overview, read the Medium article on Emotion 10. For a migration guide, visit the migrating to Emotion 10 page on emotion.sh
:rocket: Enhancement
- ๐ The css prop works without
babel-plugin-emotion
- The css prop receives the theme
- Labels are added to the css prop without
babel-plugin-emotion
in some cases
- โ Add the Global and ClassNames components
- ๐ styled uses forwardRef
- โ Add the as prop to styled
- Providing options can be done via the CacheProvider
- The autoLabel and sourceMap options are enabled in development with the Babel Macros
- 0๏ธโฃ The autoLabel and sourceMap options are on by default in development in
babel-plugin-emotion
- โ Add warning for kebab-case css properties in objects
- โ Add keyframes to snapshots with jest-emotion
- โ Add codemod rules for Emotion 10
- ๐ Fix SSR with _ in labels
- โ Add warnings for unsafe pseudo classes
:boom: Breaking Change
- create-emotion no longer accepts a global context object
- ๐ Support for preact-emotion has been dropped(note that the emotion package still works with preact)
- ๐ Emotion only supports react@>=16.3
- ๐ The
channel
andcreateBroadcast
exports from emotion-theming have been removed - ๐ The
extractStatic
option to babel-plugin-emotion has been removed - jest-emotion no longer accepts an emotion instance
create-emotion-server
accepts a cache instead of an emotion instance- ๐ The css prop doesn't work via the babel plugin.
jsx
can be manually imported from@emotion/core
(which can be automated with eslint-plugin-emotion) or babel-plugin-jsx-pragmatic can be used. - โ Functions in interpolations are stringified in css and cx calls(probably won't affect you very much, there's a warning about it in v9)
create-emotion
doesn't return a caches property and instead returns a cache property which is the same return value as@emotion/cache
- ๐ The
importedNames
option to babel-plugin-emotion is gone - The
hoist
option is gone, hoisting always happens
- ๐ The css prop works without