# right

> Applies the physical `right` property, for offsets genuinely tied to the viewport's right side.

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

Applies the physical `right` property, for offsets genuinely tied to the
viewport's right side. `u.insIe()` (`inset-inline-end`) covers the
writing-direction-aware default.

## Quick reference

Every documented call, beside the CSS it emits.

| Call | CSS |
| --- | --- |
| `u.insRight(4)` | `css({ right: "calc(var(--ui-spacing, 0.25rem) * 4)" })` |

## Examples

### Basic example

Use `insRight(n)` to set the `right` offset of a positioned element from the spacing scale:

```tsx
<div mix={[...]}>
	<div mix={[relative(), is(48), bs(32), ...]}>
		<div mix={[absolute(), insRight(0), ...]}>insRight(0)</div>
	</div>
	<div mix={[relative(), is(48), bs(32), ...]}>
		<div mix={[absolute(), insRight(6), ...]}>insRight(6)</div>
	</div>
</div>
```

### Using negative values

Pass a negative step, like `insRight(-2)`, to push an element past the edge of its parent, like a badge over an avatar:

```tsx
<div mix={[relative(), is(16), bs(16), ...]}>
	<span
		mix={[
			absolute(),
			insTop(-2),
			insRight(-2),
			center(),
			is(6),
			bs(6),
			rounded("full"),
			bg("danger.solid"),
			fg("danger.onSolid"),
			text("xs"),
		]}
	>
		3
	</span>
</div>
```

## Using a custom value

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

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

## Applying on a state

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

```ts
u.hover(u.insRight(4))
```

## Responsive design

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

```ts
u.at("md", u.insRight(4))
```

## 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
insRight(4)
```

## Signature

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