Tailwind @screen directive equivalent #179
-
Hello |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Which directives are you interested in using? |
Beta Was this translation helpful? Give feedback.
-
You could use the tw import for that example:
But if you're writing conditional styles or regular css then you'll need to use the styled import (or css prop). If you want to work with the config breakpoints, you could make reusable functions to help sync them with tailwind: import tw, { css, theme } from 'twin.macro'
const minXl = content => css`
@media (min-width: ${theme`screens.xl`}) {
${content}
}
`
const xlStyles = minXl(`
${tw`block`}
color: red;
`)
const StyledButton = styled.button(() => [
tw`bg-black`,
xlStyles,
]) As of 1.12.0, the theme import allows you to grab the screens object from the config (as opposed to a single value). |
Beta Was this translation helpful? Give feedback.
Which directives are you interested in using?