Add leading trim to your typography classes in tailwindcss. Responsive and simple to add to any existing tailwind project.
Installation:
npm i --save-dev tailwind-leading-trim
yarn add -D tailwind-leading-trim
Setup:
tailwind.config.js
module.exports = {
...
theme: {
fontFamily: {
"sans": "Inter",
},
fontMetrics: {
"capHeight": 2048,
"ascent": 2728,
"descent": -680,
"lineGap": 0,
"unitsPerEm": 2816,
},
},
...
plugins: [require('tailwind-leading-trim')],
}
<div className="text-4xl font-sans leading-trim-both"> The quick brown fox jumps over the lazy dog </div>
<div className="text-4xl font-sans leading-trim-start"> The quick brown fox jumps over the lazy dog </div>
<div className="text-4xl font-sans leading-trim-end"> The quick brown fox jumps over the lazy dog </div>