SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

flex-wrap

Sets flex-wrap, defaulting to wrap.

tsx
import { flexWrap } from "@sdxc/u/layout";

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.flexWrap()css({ flexWrap: "wrap" })
u.flexWrap("nowrap")css({ flexWrap: "nowrap" })

Examples

Basic example

Use flexWrap() to let flex items wrap onto a new line when they run out of room:

01
02
03
04
05
tsx
<div mix={[flex(), flexWrap(), gap(4), is(96), ...]}>
	<div mix={[is(28), ...]}>01</div>
	<div mix={[is(28), ...]}>02</div>
	<div mix={[is(28), ...]}>03</div>
	<div mix={[is(28), ...]}>04</div>
	<div mix={[is(28), ...]}>05</div>
</div>

Don't wrap

Use flexWrap("nowrap") to keep every item on one line, shrinking them to fit:

01
02
03
04
05
tsx
<div mix={[flex(), flexWrap("nowrap"), gap(4), is(96), ...]}>
	<div mix={[is(28), ...]}>01</div>
	<div mix={[is(28), ...]}>02</div>
	<div mix={[is(28), ...]}>03</div>
	<div mix={[is(28), ...]}>04</div>
	<div mix={[is(28), ...]}>05</div>
</div>

Wrap in reverse

Use flexWrap("wrap-reverse") to wrap items onto new lines stacked in the opposite direction:

01
02
03
04
05
tsx
<div mix={[flex(), flexWrap("wrap-reverse"), gap(4), is(96), ...]}>
	<div mix={[is(28), ...]}>01</div>
	<div mix={[is(28), ...]}>02</div>
	<div mix={[is(28), ...]}>03</div>
	<div mix={[is(28), ...]}>04</div>
	<div mix={[is(28), ...]}>05</div>
</div>

Applying on a state

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

typescript
u.hover(u.flexWrap())

Responsive design

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

typescript
u.at("md", u.flexWrap())

Signature

typescript
u.flexWrap(value?: "wrap" | "nowrap" | "wrap-reverse")
@sdxc/u

Can’t find it? Contact us