Allowing `css({})` for creating className strings in @emotion/core
See original GitHub issueFirst of, Emotion is awesome, and open-source is hard, great work!
This question might have been asked, but I was wondering if the behavior of css({ })
to generate a class name is still possible in @emotion/core
?
What I want
import { css } from '@emotion/core';
<div className={css({ background: 'red' })} />
Suggested solution:
Maybe use css({ }).className
?
I know that ClassNames
is exported, but this seems quite annoying to use as a render prop. If that’s the way to go, any chance we could export ClassNames.css
and ClassNames.cx
as static methods?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
The css Prop - Emotion
css from @emotion/react does not return the computed class name string. The function returns an object containing the computed name and flattened styles....
Read more >Why you shouldn't use @emotion/core - Colin McDonnell
Emotion recommends using their non-standard css prop to style your components, instead of React's built-in className . This causes me ...
Read more >Emotion 10: CSS-in-JS with Flexible Scoped and Global ...
Class names containing Emotion styles from the className prop override css prop styles. Class names from sources other than Emotion are ignored ...
Read more >@emotion/react | Yarn - Package Manager
Install. yarn add @emotion/react. Usage. /** @jsx jsx */ import { jsx, css, Global, ClassNames } from '@emotion/react' render( <div css={{ color: 'hotpink'...
Read more >npm:react-classed | Skypack
Create React components with CSS classes. ... You can pass an array of classnames and allow any type of other input:
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe the “
css()
generates/returns a class name” functionality is in the framework-agnosticemotion
package as of v10.See:
If you were asking for this to be specifically added in
@emotion/core
, then carry on; but the re-org of the packages was a little unclear at first. However, I think the intro docs explain the goal of each package very well now.Thanks!