Tailwind CSS - Responsive breakpoints as components
By tailwind You can use and Customizing the default breakpoints for your project.
Open your
tailwind.config.js
Update/add
screens
inside yourmodule.exports
:theme: { screens: { 'sm': '640px', // => @media (min-width: 640px) { ... } 'md': '768px', // => @media (min-width: 768px) { ... } 'lg': '1024px', // => @media (min-width: 1024px) { ... } 'xl': '1280px', // => @media (min-width: 1280px) { ... } } }
Source: https://tailwindcss.com/docs/breakpoints
I found the @screen directive, that solves this question:
https://tailwindcss.com/docs/functions-and-directives/#screen
as easy as
@screen md {
// whatever
}