Skip to content

Instantly share code, notes, and snippets.

@BaileySimrell
Last active September 21, 2024 17:36
Show Gist options
  • Save BaileySimrell/c2621465fca3fe5a896627f44ba86780 to your computer and use it in GitHub Desktop.
Save BaileySimrell/c2621465fca3fe5a896627f44ba86780 to your computer and use it in GitHub Desktop.
This component is a useful tool for anyone working with Tailwind CSS, allowing you to easily see which responsive breakpoint is active without needing to open browser developer tools.
export function TailwindIndicator() {
if (process.env.NODE_ENV === 'production') return null
return (
<div className="fixed bottom-1 left-1 z-50 flex size-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-white">
<div className="block sm:hidden">xs</div>
<div className="hidden sm:block md:hidden">sm</div>
<div className="hidden md:block lg:hidden">md</div>
<div className="hidden lg:block xl:hidden">lg</div>
<div className="hidden xl:block 2xl:hidden">xl</div>
<div className="hidden 2xl:block">2xl</div>
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment