clamp-size

Fluid sizes without hand-writing clamp() math. This page is styled by docs/style.scss, which imports the package straight from the repo (@use '../index' as clamp;) — not from npm — so resizing this window proves the current source actually works.

Viewport width: px

size() with breakpoint keys

Resize the browser window between the 'sm' (576px) and 'lg' (992px) breakpoints to see it scale.

Fluid heading text

font-size: clamp.size(16px, 24px, 'sm', 'lg');

size() with numeric widths

Same idea, but with explicit pixel widths instead of breakpoint keys.

Fluid heading text

font-size: clamp.size(10px, 20px, 360px, 1400px);

Inverted min/max

$min-size (24px) is larger than $max-size (16px) here — the result still increases smoothly as the viewport shrinks, rather than producing a broken/negative clamp.

Shrinks as the viewport grows

font-size: clamp.size(24px, 16px, 'sm', 'lg');

csize() — container query units

This scales with the box below, not the viewport. Drag its bottom-right corner to resize it (native CSS resize, no JS) and watch the text react.

Container-fluid text

font-size: clamp.csize(14px, 32px, 200px, 800px);