# scale

> Scales the element uniformly on both axes — sugar for setting `u.scaleX()` and `u.scaleY()` to the same factor in one call.

```ts
import { scale } from "@sdxc/u/transform";
```

Scales the element uniformly on both axes — sugar for setting `u.scaleX()`
and `u.scaleY()` to the same factor in one call. Composable with every
other `transform/` utility.

## Quick reference

Every documented call, beside the CSS it emits.

| Call | CSS |
| --- | --- |
| `u.scale(1.5)` | `css({ "--ui-scale-x": "1.5", "--ui-scale-y": "1.5", transform: "..." })` |

## Examples

### Basic example

Use `scale(n)` with a unitless factor, like `scale(0.75)` or `scale(1.25)`, to resize an element on both axes:

```tsx
<div mix={[...]}>
	<div mix={[...]}>
		<div mix={[scale(0.75), ...]}>scale(0.75)</div>
	</div>
	<div mix={[...]}>
		<div mix={[scale(1), ...]}>scale(1)</div>
	</div>
	<div mix={[...]}>
		<div mix={[scale(1.25), ...]}>scale(1.25)</div>
	</div>
</div>
```

### Using percentages

Pass a string to scale by a percentage, like `scale("50%")`:

```tsx
<div mix={[...]}>
	<div mix={[...]}>
		<div mix={[scale("50%"), ...]}>scale("50%")</div>
	</div>
	<div mix={[...]}>
		<div mix={[scale("110%"), ...]}>scale("110%")</div>
	</div>
</div>
```

### Using negative values

A negative factor, like `scale(-1)`, mirrors an element on both axes:

```tsx
<div mix={[...]}>
	<div mix={[...]}>
		<div mix={[scale(-1), ...]}>scale(-1)</div>
	</div>
	<div mix={[...]}>
		<div mix={[scale(-0.75), ...]}>scale(-0.75)</div>
	</div>
</div>
```

### Applying on hover

Wrap it in `hover()` and add a `transition("transform")` to grow an element under the pointer. Hover the tile to try it:

```tsx
<div mix={[...]}>
	<div mix={[...]}>
		<div mix={[hover(scale(1.15)), transition("transform"), ...]}>hover me</div>
	</div>
</div>
```

## Using a custom value

Every scale argument also takes a raw CSS value, which passes through untouched.

```ts
u.scale("2.75rem")
```

## Applying on a state

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

```ts
u.hover(u.scale(1.5))
```

## Responsive design

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

```ts
u.at("md", u.scale(1.5))
```

## Signature

```ts
u.scale(value: ScaleValue)
```
