# flex-grow

> Applies `flex-grow`.

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

Applies `flex-grow`. Defaults to `1`, the common case of a flexible item —
a content area next to a fixed-size sidebar or icon — that should expand
to fill whatever room is left in its flex container.

## Quick reference

Every documented call, beside the CSS it emits.

| Call | CSS |
| --- | --- |
| `u.grow()` | `css({ flexGrow: "1" })` |
| `u.grow(0)` | `css({ flexGrow: "0" })` |

## Examples

### Basic example

Use `grow()` to let a flex item grow to fill any available space:

```tsx
<div mix={[flex(), gap(4), is("full")]}>
	<div mix={[is(14), ...]}>01</div>
	<div mix={[grow(), ...]}>grow()</div>
	<div mix={[is(14), ...]}>03</div>
</div>
```

### Growing in proportion

Pass a factor like `grow(2)` to grow items in proportion to each other, here from a `basis(0)` so the shares are exact:

```tsx
<div mix={[flex(), gap(4), is("full")]}>
	<div mix={[grow(1), basis(0), ...]}>grow(1)</div>
	<div mix={[grow(2), basis(0), ...]}>grow(2)</div>
	<div mix={[grow(1), basis(0), ...]}>grow(1)</div>
</div>
```

### Preventing items from growing

Use `grow(0)` to keep an item at its own size while its siblings grow:

```tsx
<div mix={[flex(), gap(4), is("full")]}>
	<div mix={[grow(), ...]}>grow()</div>
	<div mix={[grow(0), ...]}>grow(0)</div>
	<div mix={[grow(), ...]}>grow()</div>
</div>
```

## Applying on a state

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

```ts
u.hover(u.grow())
```

## Responsive design

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

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

## Signature

```ts
u.grow(value?: number | (string & {}))
```
