Tailwind for Unity UI Toolkit.
Install using Unitys built-in package manager, UPM.
Unity Package Manager
-> Install Package from git URL...
https://github.com/kalvinpearce/TailwindUSS.git
This package supplies a TailwindUSS.<pseudo>.uss
file that can be added to
any .uxml
or linked in any .cs
script.
A few helpers have been supplied to assist with adding styles in bulk.
To use them, simply put using TailwindUSS;
at the top of the script.
.Tailwind
It takes a string of tailwind classes, separated by spaces. It will automatically apply the relevant stylesheets when used in editor scripts, otherwise they need to be added manually in the uxml.
using TailwindUSS;
// ...
VisualElement label = new Label("Hello World! From TailwindUSS");
label.Tailwind("text-2xl text-red-500 m-4 transition-all hover:text-blue-500");
For a better editor experience, please use the official Tailwind plugin and follow the instructions below.
tailwindCSS.includeLanguages
Add Item
csharp
& Value: html
Tailwind("...")
tailwindCSS.experimental.classRegex
Edit in settings.json
"Tailwind\\(\"([^\"]*)"
npx tailwindcss init
in a terminal in the project root"Assets/**/*.cs"
to the content array in tailwind.config.js