Skip to content

Instantly share code, notes, and snippets.

@jose-mdz
Last active February 1, 2024 01:22
Show Gist options
  • Save jose-mdz/0f4708f094e70009367529e1b9eb6a4e to your computer and use it in GitHub Desktop.
Save jose-mdz/0f4708f094e70009367529e1b9eb6a4e to your computer and use it in GitHub Desktop.
Use Tailwind Screen config in code
import resolveConfig from "tailwindcss/resolveConfig";
import tailwindConfig from "../../tailwind.config";
function Component() {
const fullConfig = resolveConfig(tailwindConfig);
const [horizontal, setHorizontal] = useState<boolean>(
screen && screen.availWidth >= parseInt(fullConfig.theme.screens.sm),
);
// Do something with decision
return <div/>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment