@gluhar/fluid
Tailwind CSS v4 plugin: fluid type and spacing via clamp(), with device-banded typography — one ramp per device band, stacked as min-width queries, continuous across band boundaries.
Framework-agnostic: it's a Tailwind plugin, not a Nuxt module. @gluhar/theme does not depend on it.
Use
@import "tailwindcss";
@plugin "@gluhar/fluid" {
bands: mobile, tablet, desktop;
}
@theme {
/* min / design / max viewport, px. The LAST band listed is primary. */
--fl-band-mobile: 320 390 480;
--fl-band-tablet: 768 820 1200;
--fl-band-desktop: 1200 1600 1920;
/* Display: proportional. Plain token = primary band's design value. */
--text-5xl: 3.75rem;
--text-5xl--tablet: 2.4375rem 2.625rem 2.8125rem; /* lower base upper */
--text-5xl--mobile: 1.75rem 2.125rem 2.4375rem;
/* Body/UI: two values = linear between the band's own endpoints. */
--text-md: 1rem;
--text-md--desktop: 0.9375rem 1.05rem;
--text-md--tablet: 0.9rem 0.9375rem;
--text-md--mobile: 0.85rem 0.9rem;
}
Then fl-text-5xl, fl-text-md, fl-p-4, fl-gap-8, fl-text-[32px], fl-text-sm/xl, fl-py-4/8.
Rules
- Once a project uses banded type, use
fl-text-*everywhere. Plaintext-*gets the single primary value with no ramp. - Never put a multi-value form on a plain
--text-*token. Tailwind's owntext-*emitsfont-size: var(--text-*)verbatim, so the native utility silently dies. The plugin warns. Put limits on--text-<key>--<band>. - Make each band's upper endpoint equal the next band's lower endpoint, so the scale has no step at the breakpoints.
- Two-value form for body/UI copy (gentle slope); proportional / three-value form for display sizes.
Limits (known, by design for now)
- Spacing utilities are not banded — they use the primary band's window.
- Line height is read once (
lineHeight: trueoption), not per band. - Arbitrary values (
fl-text-[32px]) resolve against the primary band only.