Skip to content

Instantly share code, notes, and snippets.

@PhilippMeissner
Last active December 4, 2021 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhilippMeissner/27397248c10893257b9e617571151b6a to your computer and use it in GitHub Desktop.
Save PhilippMeissner/27397248c10893257b9e617571151b6a to your computer and use it in GitHub Desktop.
React component showing active tailwind viewport
const Viewport = () => {
return (
<span className={"absolute top-4 right-4"}>
<pre className="sm:hidden">base</pre>
<pre className="hidden sm:block md:hidden">sm</pre>
<pre className="hidden md:block lg:hidden">md</pre>
<pre className="hidden lg:block xl:hidden">lg</pre>
<pre className="hidden xl:block 2xl:hidden">xl</pre>
<pre className="hidden 2xl:block">2xl</pre>
</span>
);
};
export default Viewport;
@PhilippMeissner
Copy link
Author

This snippet implements the currently (at the time of writing) available default breakpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment