15 kB · 370 lines
Markdown
at main

# Material Theme Plugin for Tailwind CSS Use the Material design system with Tailwind CSS. Based on [material.io](https://m3.material.io/). # Get started ### Install ``` npm install --save-dev @claas.dev/material-tailwind ``` ### Configure plugin #### Tailwind CSS v4.0 ```css /* This is from your Tailwind CSS install */ @import "tailwindcss"; @plugin "@claas.dev/material-tailwind" { /* Pick your favorite color */ source-color: #0c1445; } ``` The [live example](https://santaclaas.github.io/material-tailwind/) shows every generated color role. Its [source](https://github.com/SantaClaas/material-tailwind/tree/main/example) uses SolidJS and is a reference for setting the plugin up. #### Tailwind CSS v3.0 (or v4.0 with configuration file) In your Tailwind CSS configuration e.g. `tailwind.config.js` ```js import materialTailwind from "@claas.dev/material-tailwind"; /** @type {import('tailwindcss').Config} */ export default { content: ["./index.html", "./src/**/*.{js,jsx,ts,tsx}"], theme: { extend: {}, }, // Choose your source color to construct your theme from plugins: [materialTailwind({ sourceColor: "#0c1445" })], }; ``` ### Options | Option | Values | Default | | -------------- | --------------------------------------------------------------------------------------------------------------- | ------------ | | `source-color` | Any hex color | _(required)_ | | `variant` | `monochrome`, `neutral`, `tonal-spot`, `vibrant`, `expressive`, `fidelity`, `content`, `rainbow`, `fruit-salad` | `tonal-spot` | | `spec-version` | `2021`, `2025` | `2021` | | `gamut` | `srgb`, `display-p3` (or `p3`), `rec2020` …