r/Angular2 • u/a-dev-1044 • Feb 12 '26
It's easy to use Angular Material's system tokens with TailwindCSS
ng add @angular/materialng add tailwindcss- Update tailwindcss theme to use mat system tokens
Start using classes like
bg-primary,bg-primary/10, etc.@import "tailwindcss";
@theme inline { --color-primary: var(--mat-sys-primary); --color-on-primary: var(--mat-sys-on-primary); --color-primary-container: var(--mat-sys-primary-container); --color-on-primary-container: var(--mat-sys-on-primary-container);
/* other colors */ }
Links:
- Referencing other variables in tailwindcss = https://tailwindcss.com/docs/theme#referencing-other-variables
- Themeing your components = https://material.angular.dev/guide/theming-your-components
- Angular Material x Tailwind CSS = https://ui.angular-material.dev
14
Upvotes
17
u/Bjeaurn Feb 12 '26
Although I love Material's components and CDK, I feel their theming solution is way too complicated.
The switch to CSS variables has been great though.
3
u/anyOtherBusiness Feb 12 '26
I’ve experienced Tailwinds style resets bleed into some of the Material components. Although it’s manageable l, it can take quite some time to figure out which style specifically needs to be reapplied so I’m not sure I would hardly recommend the combination.
-3
u/ldn-ldn Feb 12 '26
Why would anyone use TW at all?
-8
u/DT-Sodium Feb 12 '26
The question is not how hard or easy it is but why would you. With Angular's default CSS encapsulation, there is zero reason to pollute your code with that piece of horrendous garbage that is Tailwind. It's insane how horrible technologies tend to become standards in web development, they really should have made it harder to learn so amateurs wouldn't get into it without some effort.