[ @sdxc/u/size ]
max-block-size
Applies max-block-size.
import { maxBs } from "@sdxc/u/size";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.maxBs("full") | css({ maxBlockSize: "100%" }) |
Examples
Basic example
Use maxBs(n) to cap an element's block size, and pair it with overflowY("auto") to scroll whatever does not fit:
Margins, padding and sizes in this package follow the writing mode, so a layout written once reads correctly in every language. A card padded on its inline start keeps that padding where a sentence begins, whichever side of the screen that is, and the same holds for a list, a sidebar or a toolbar.
<div mix={[maxBs(32), is(72), overflowY("auto"), ...]}>
<p mix={[...]}>
Margins, padding and sizes in this package follow the writing mode, so a layout written once
reads correctly in every language. A card padded on its inline start keeps that padding
where a sentence begins, whichever side of the screen that is, and the same holds for a
list, a sidebar or a toolbar.
</p>
</div>Content shorter than the cap
A maximum only limits: an element shorter than maxBs(24) keeps its own size, and one asking for more stops at the cap:
<div mix={[hstack({ gap: 4, align: "start" })]}>
<div mix={[maxBs(24), bs(12), is(40), ...]}>bs(12)</div>
<div mix={[maxBs(24), bs(48), is(40), ...]}>bs(48)</div>
</div>Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.maxBs("full"))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.maxBs("full"))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:
maxBs(4)Signature
u.maxBs(value: SizeValue)