# overflow-x

> Applies `overflow-x`, independently of the block axis.

```ts
import { overflowX } from "@sdxc/u/overflow";
```

Applies `overflow-x`, independently of the block axis.

## Quick reference

Every documented call, beside the CSS it emits.

| Call | CSS |
| --- | --- |
| `u.overflowX("auto")` | `css({ overflowX: "auto" })` |

## Examples

### Basic example

Use `overflowX("auto")` to let an element scroll horizontally when its content is wider than it is. Scroll the row sideways:

```tsx
<div mix={[overflowX("auto"), hstack({ gap: 4 }), is(96), maxIs("100%"), p(4), ...]}>
	<div mix={[shrink(), is(24), ...]}>1</div>
	<div mix={[shrink(), is(24), ...]}>2</div>
	<div mix={[shrink(), is(24), ...]}>3</div>
	<div mix={[shrink(), is(24), ...]}>4</div>
	<div mix={[shrink(), is(24), ...]}>5</div>
</div>
```

### Scrolling always

Use `overflowX("scroll")` to always show a horizontal scrollbar, where the operating system draws one, even when the content fits:

```tsx
<div mix={[overflowX("scroll"), hstack({ gap: 4 }), is(96), maxIs("100%"), p(4), ...]}>
	<div mix={[shrink(), is(24), ...]}>1</div>
	<div mix={[shrink(), is(24), ...]}>2</div>
</div>
```

### Clipping horizontally

Call `overflowX()`, which applies `hidden`, to clip content that is wider than its element:

```tsx
<div mix={[overflowX(), hstack({ gap: 4 }), is(96), maxIs("100%"), p(4), ...]}>
	<div mix={[shrink(), is(24), ...]}>1</div>
	<div mix={[shrink(), is(24), ...]}>2</div>
	<div mix={[shrink(), is(24), ...]}>3</div>
	<div mix={[shrink(), is(24), ...]}>4</div>
	<div mix={[shrink(), is(24), ...]}>5</div>
</div>
```

## Applying on a state

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

```ts
u.hover(u.overflowX("auto"))
```

## Responsive design

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

```ts
u.at("md", u.overflowX("auto"))
```

## Signature

```ts
u.overflowX(value?: OverflowValue)
```
