This custom Tailwind css plugin, helps build a matrix of font sizes and breakpoints.
- Install the package in your project
npm install @40q/tailwindcss-font-sizes-matrix
or
yarn add @40q/tailwindcss-font-sizes-matrix
- Import the package in your tailwind configuration file.
import { fontSizesMatrix } from "@40q/tailwindcss-font-sizes-matrix";
- Disable Tailwind's default font sizes:
theme: {
fontSize: {}
}
- Call the function in the plugins array and fill the configuration object. This example will generate the class
text-xs
.
plugins: [
fontSizesMatrix({
xs: {
default: {
fontSize: "0.75rem",
lineHeight: "1rem",
},
md: "0.875rem",
lg: "1rem"
}
})
]