[ @sdxc/u/layout ]
align-items
Sets align-items.
import { items } from "@sdxc/u/layout";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.items("center") | css({ alignItems: "center" }) |
Examples
Basic example
Use items("center") to align items along the center of the container's cross axis:
01
02
03
<div mix={[flex(), gap(4), items("center"), is(80), bs(36), ...]}>
<div mix={[bs(12), ...]}>01</div>
<div mix={[bs(24), ...]}>02</div>
<div mix={[bs(16), ...]}>03</div>
</div>Start and end
Use items("start") or items("end") to align items to the start or the end of the cross axis:
01
02
03
01
02
03
<div mix={[...]}>
<div mix={[flex(), gap(4), items("start"), is(64), bs(36), ...]}>
<div mix={[bs(12), ...]}>01</div>
<div mix={[bs(24), ...]}>02</div>
<div mix={[bs(16), ...]}>03</div>
</div>
<div mix={[flex(), gap(4), items("end"), is(64), bs(36), ...]}>
<div mix={[bs(12), ...]}>01</div>
<div mix={[bs(24), ...]}>02</div>
<div mix={[bs(16), ...]}>03</div>
</div>
</div>Stretch
Use items("stretch") to stretch items to fill the container's cross axis:
01
02
03
<div mix={[flex(), gap(4), items("stretch"), is(80), bs(36), ...]}>
<div mix={[...]}>01</div>
<div mix={[...]}>02</div>
<div mix={[...]}>03</div>
</div>Baseline
Use items("baseline") to align items so the first lines of their text share a baseline:
01
02
03
<div mix={[flex(), gap(4), items("baseline"), is(80), ...]}>
<div mix={[p(2, 4), ...]}>01</div>
<div mix={[p(8, 4), ...]}>02</div>
<div mix={[p(5, 4), ...]}>03</div>
</div>Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.items("center"))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.items("center"))Signature
u.items(value?: AlignItemsValue)