# flex-wrap

> Sets `flex-wrap`, defaulting to `wrap`.

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

Sets `flex-wrap`, defaulting to `wrap`.

## Quick reference

Every documented call, beside the CSS it emits.

| Call | CSS |
| --- | --- |
| `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:

```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:

```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:

```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.

```ts
u.hover(u.flexWrap())
```

## Responsive design

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

```ts
u.at("md", u.flexWrap())
```

## Signature

```ts
u.flexWrap(value?: "wrap" | "nowrap" | "wrap-reverse")
```
