# margin-right

> Sets the physical `margin-right` property directly, pinned to the fixed right edge regardless of writing direction.

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

Sets the physical `margin-right` property directly, pinned to the fixed
right edge regardless of writing direction. Prefer `u.mi()`
(`margin-inline`) for direction-aware margins.

## Quick reference

Every documented call, beside the CSS it emits.

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

## Examples

### Basic example

Use `marginRight(n)` to add margin to the right edge of an element, whatever the writing direction:

```tsx
<div mix={[...]}>
	<div mix={[marginRight(12), ...]}>marginRight(12)</div>
</div>
```

### Right-to-left text

In right-to-left text `marginRight()` stays on the right, while `mie()` follows the direction to the end of the line on the left:

```tsx
<div dir="rtl" mix={[...]}>
	<div mix={[...]}>
		<div mix={[marginRight(12), ...]}>marginRight(12)</div>
	</div>
	<div mix={[...]}>
		<div mix={[mie(12), ...]}>mie(12)</div>
	</div>
</div>
```

## Using a custom value

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

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

## Applying on a state

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

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

## Responsive design

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

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

## Signature

```ts
u.marginRight(value: SpacingValue)
```
