This Tailwind CSS plugin provides custom variants to apply styles to apps that are running on the ToDesktop platform. There are also platform specific variants that target Windows, macOS, and Linux.
- Provides
.todesktopvariant to target apps running on the ToDesktop platform. - Provides
.windows,.mac, and.linuxvariants.
Install the plugin from npm:
npm install @todesktop/tailwind-variantsAdd the plugin to your tailwind.config.js file:
module.exports = {
// ...
plugins: [
require("@todesktop/tailwind-variants"),
// ...
],
};Once the plugin is installed and enabled, you can use the variants in your Tailwind CSS classes like so:
<!-- Hide div on desktop app -->
<div class="todesktop:hidden">
<!-- ... -->
</div><!-- Show div on desktop app, hide on web app -->
<div class="hidden todesktop:block">
<!-- ... -->
</div><!-- Hide div on Windows desktop app (will still show on Mac/Linux) -->
<div class="windows:hidden">
<!-- ... -->
</div><!-- On Mac desktop app make `div` rounded with a shadow -->
<div class="w-20 h-20 bg-blue mac:rounded-lg mac:shadow-lg">
<!-- ... -->
</div>- Thanks to Peer Richelsen for requesting this.