Styled API
See original GitHub issueAdd support for styled-components style API:
import tw from 'tailwind.macro'
let Header = tw.header`bg-red text-center`
Should we use the default export like above, or use a separate named export? For example:
import { styled } from 'tailwind.macro'
let Header = styled.header`bg-red text-center`
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
styled() - MUI System
Utility for creating styled components. ... This example demonstrates how you can use the styled API to create custom components, with the same...
Read more >API Reference
A function that receives the props that are passed into the component and computes a value, that is then going to be merged...
Read more >API
The space utility converts shorthand margin and padding props to margin and padding CSS declarations. Numbers from 0 to the length of theme.space...
Read more >The Essential Guide to MUI Styled Components
MUI Styled Import ... Most developers should use the MUI-recommended approach, which is the styled() API that wraps emotion. ... Here is the ......
Read more >Using styled API in ReactJS
Styled components in ReactJS is a CSS-in-JS library that can be used for a better UI design. This API allows us to create...
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
You can do this already in pretty much the same way you would with standard
emotion
/styled-components
:Adding classes based on props doesn’t work when using
tw.button
syntax. I had to switch to styled-components to achieve that.To illustrate, this won’t work:
This will: