How to style className using attrs #245
-
I'm trying to style a modal component by doing the following:
The problem is, when twin.macro compiles the css, it adds a hash before the class:
but the hash is not added to the component:
Am I doing this correctly or am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
There's a few ways to style something like this, but here's how you could set that Modal component up: const Modal = () => (
<div>
<div tw="fixed">Overlay</div>
<div tw="w-11/12">Content</div>
</div>
); |
Beta Was this translation helpful? Give feedback.
-
We have a bit of a weird case here as we're trying to style a modal that's rendering within a portal. Here's a demo on how you can style the modal with global styles For the styling of the actual modal content, you shouldn't have any problems styling them like normal 👍 |
Beta Was this translation helpful? Give feedback.
We have a bit of a weird case here as we're trying to style a modal that's rendering within a portal.
So we'll need to use global styles here to style just these couple of elements.
Here's a demo on how you can style the modal with global styles
For the styling of the actual modal content, you shouldn't have any problems styling them like normal 👍