# max-block-size

> Applies `max-block-size`.

```ts
import { maxBs } from "@sdxc/u/size";
```

Applies `max-block-size`.

## Quick reference

Every documented call, beside the CSS it emits.

| Call | CSS |
| --- | --- |
| `u.maxBs("full")` | `css({ maxBlockSize: "100%" })` |

## Examples

### Basic example

Use `maxBs(n)` to cap an element's block size, and pair it with `overflowY("auto")` to scroll whatever does not fit:

```tsx
<div mix={[maxBs(32), is(72), overflowY("auto"), ...]}>
	<p mix={[...]}>
		Margins, padding and sizes in this package follow the writing mode, so a layout written once
		reads correctly in every language. A card padded on its inline start keeps that padding
		where a sentence begins, whichever side of the screen that is, and the same holds for a
		list, a sidebar or a toolbar.
	</p>
</div>
```

### Content shorter than the cap

A maximum only limits: an element shorter than `maxBs(24)` keeps its own size, and one asking for more stops at the cap:

```tsx
<div mix={[hstack({ gap: 4, align: "start" })]}>
	<div mix={[maxBs(24), bs(12), is(40), ...]}>bs(12)</div>
	<div mix={[maxBs(24), bs(48), is(40), ...]}>bs(48)</div>
</div>
```

## Applying on a state

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

```ts
u.hover(u.maxBs("full"))
```

## Responsive design

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

```ts
u.at("md", u.maxBs("full"))
```

## Customizing your theme

### Customizing spacing

Every numeric step multiplies `--ui-spacing`, so redefining it rescales every spacing and sizing utility at once:

```css
:root {
	--ui-spacing: 0.25rem;
}
```

Every call that names the step now reads the new value:

```ts
maxBs(4)
```

## Signature

```ts
u.maxBs(value: SizeValue)
```
