sdxc

[ @sdxc/u/size ]

min-inline-size

Applies min-inline-size.

import { minIs } from "@sdxc/u/size";

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.minIs(0)css({ minInlineSize: "calc(var(--ui-spacing, 0.25rem) * 0)" })

Examples

Basic example

Use minIs(n) to give an element a minimum inline size, like buttons that stay at least minIs(32) wide however short their label:

<div mix={[...]}>
	<button type="button" mix={[minIs(32), ...]}>
		OK
	</button>
	<button type="button" mix={[minIs(32), ...]}>
		Cancel
	</button>
	<button type="button" mix={[minIs(32), ...]}>
		Save and continue
	</button>
</div>

Truncating inside flex

A flex item will not shrink below its content by default, so text truncated inside it overflows instead; use minIs(0) on the item to let it shrink:

PDF

quarterly-report-final-version-with-every-appendix.pdf

PDF

quarterly-report-final-version-with-every-appendix.pdf

<div mix={[...]}>
	<div mix={[hstack({ gap: 3 }), is(72), ...]}>
		<div mix={[circle(), is(10), shrink(), ...]}>PDF</div>
		<div>
			<p mix={[truncate(), ...]}>
				quarterly-report-final-version-with-every-appendix.pdf
			</p>
		</div>
	</div>
	<div mix={[hstack({ gap: 3 }), is(72), ...]}>
		<div mix={[circle(), is(10), shrink(), ...]}>PDF</div>
		<div mix={[minIs(0)]}>
			<p mix={[truncate(), ...]}>
				quarterly-report-final-version-with-every-appendix.pdf
			</p>
		</div>
	</div>
</div>

Using a custom value

Every scale argument also takes a raw CSS value, which passes through untouched.

u.minIs("2.75rem")

Applying on a state

Wrap the call in a state utility to scope it to one selector.

u.hover(u.minIs(0))

Responsive design

Wrap the call in a container query to scope it to one width.

u.at("md", u.minIs(0))

Customizing your theme

Customizing spacing

Every numeric step multiplies --ui-spacing, so redefining it rescales every spacing and sizing utility at once:

:root {
	--ui-spacing: 0.25rem;
}

Every call that names the step now reads the new value:

minIs(4)

Signature

u.minIs(value: SizeValue)

Written by Sergio Xalambrí. Follow @sergiodxa for new packages, or sponsor the work.