[ @sdxc/u/size ]
min-block-size
Applies min-block-size.
import { minBs } from "@sdxc/u/size";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.minBs(0) | css({ minBlockSize: "calc(var(--ui-spacing, 0.25rem) * 0)" }) |
Examples
Basic example
Use minBs(n) to give an element a minimum block size; content taller than the minimum still grows past it:
One line.
Several lines of text, more than the minimum holds, so the card grows.
<div mix={[hstack({ gap: 4, align: "start" })]}>
<div mix={[minBs(32), is(48), ...]}>
<p mix={[...]}>One line.</p>
</div>
<div mix={[minBs(32), is(48), ...]}>
<p mix={[...]}>
Several lines of text, more than the minimum holds, so the card grows.
</p>
</div>
</div>Keeping a footer down
Combine minBs() with a stack that spreads its children to keep a card's footer at its bottom edge, however short the content:
A short note.
Updated today
<div mix={[vstack({ justify: "between" }), minBs(48), is(64), ...]}>
<p mix={[...]}>A short note.</p>
<p mix={[...]}>Updated today</p>
</div>Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.minBs("2.75rem")Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.minBs(0))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.minBs(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:
minBs(4)Signature
u.minBs(value: SizeValue)