[ @sdxc/u/layout ]
inset-block-end
Applies inset-block-end — the trailing block edge, the bottom edge in a horizontal writing mode.
import { insBe } from "@sdxc/u/layout";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.insBe(4) | css({ insetBlockEnd: "calc(var(--ui-spacing, 0.25rem) * 4)" }) |
Examples
Basic example
Use insBe(n) to set the inset-block-end offset of a positioned element from the spacing scale, the bottom edge in horizontal text:
<div mix={[...]}>
<div mix={[relative(), is(48), bs(32), ...]}>
<div mix={[absolute(), insBe(0), ...]}>insBe(0)</div>
</div>
<div mix={[relative(), is(48), bs(32), ...]}>
<div mix={[absolute(), insBe(6), ...]}>insBe(6)</div>
</div>
</div>Pinning to a corner
Combine insBe() with insIe() to pin an element into the end corner of its container, like a toast:
<div mix={[relative(), is(72), bs(40), ...]}>
<div mix={[absolute(), insBe(4), insIe(4), ...]}>Changes saved</div>
</div>Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.insBe("2.75rem")Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.insBe(4))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.insBe(4))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:
insBe(4)Signature
u.insBe(value: SpacingValue)