# max-height

> Applies the physical `max-height` property, for components whose sizing tracks the physical viewport axis.

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

Applies the physical `max-height` property, for components whose sizing
tracks the physical viewport axis. Use `u.maxBs()` (`max-block-size`) for
the logical block-axis default.

## Quick reference

Every documented call, beside the CSS it emits.

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

## Examples

### Basic example

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

```tsx
<div mix={[maxHeight(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 `maxHeight(24)` keeps its own height, and one asking for more stops at the cap:

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

## Applying on a state

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

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

## Responsive design

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

```ts
u.at("md", u.maxHeight("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
maxHeight(4)
```

## Signature

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