Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extends your Tailwind v4 themes variables adding ALL Angular's 20.2.2 Material system variables

License

NotificationsYou must be signed in to change notification settings

adandedjanstephane-git/Angular-Material-Tailwind-Integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

A stable, themeable set of CSS custom properties mapping Material Design System tokens to Tailwind CSS utility classes.

Overview

This project provides a project-scoped mapping of Material Design CSS variables (--mat-sys-*) to custom property namespaces compatible with Tailwind CSS v4 utilities. It allows you to use Material tokens in your HTML via Tailwind utility classes,without the need for square bracket syntax.

Why?

  • Seamless theming: Override Material tokens globally or per scope for easy theme changes.
  • Tailwind-friendly: Use variables in utility classes likebg-mat-primary-container ortext-mat-on-surface.
  • Maintainability: Components consume tokens, not hardcoded values, for maximum flexibility.

Variable Namespaces

Tailwind v4 supports the following variable namespaces for utility classes:

NamespaceUtility Example
--color-*bg-red-500,text-sky-300
--font-*font-sans
--text-*text-xl
--spacing-*px-4,max-h-16
--radius-*rounded-sm
......

(SeeTailwind docs for more.)

Mapping Structure

Each custom variable maps to a Material Design token:

--color-mat-primary:var(--mat-sys-primary);--color-mat-on-surface:var(--mat-sys-on-surface);

Usage

In your HTML (with Tailwind):

<divclass="text-mat-on-surface bg-mat-primary-container">  Hello World</div>

Theming & Scoping

To change a theme value globally:

:root {--mat-sys-primary:#6200ee;}

To override for a specific scope:

.my-scope {--mat-primary:#6200ee;}

Switch themes by applying a class to<body> or a container:

.theme-dark {--mat-sys-primary:#333;/* ... */}

Accessibility

  • Always usemat-on-* variables for text/icons to ensure proper contrast.
  • Never hardcode color values in components—consume tokens!

Best Practices

  • Keep variable mappings consistent.
  • Use:root or theme classes for overrides.
  • Use Tailwind utility classes for all styling.

References


This file acts as an indirection layer; keep mappings stable for reliable theming.

About

Extends your Tailwind v4 themes variables adding ALL Angular's 20.2.2 Material system variables

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp