# backdropOpacity

> Fades what shows through the element's translucent background, taking CSS's native `0`–`1` range or a percentage string.

```ts
import { backdropOpacity } from "@sdxc/u/effects";
```

Fades what shows through the element's translucent background, taking CSS's
native `0`–`1` range or a percentage string. Composes with every other
backdrop utility; wrap in `u.transparencySafe()` for a solid fallback.

## Quick reference

Every documented call, beside the CSS it emits.

| Call | CSS |
| --- | --- |
| `u.backdropOpacity()` | `css({ "--ui-backdrop-opacity": "0.5", backdropFilter: "... opacity(var(--ui-backdrop-opacity, 1)) ...", WebkitBackdropFilter: "... opacity(var(--ui-backdrop-opacity, 1)) ..." })` |
| `u.transparencySafe(u.backdropOpacity("25%"))` | `css({ "@media (prefers-reduced-transparency: no-preference)": { "--ui-backdrop-opacity": "25%", backdropFilter: "...", WebkitBackdropFilter: "..." } })` |

## Examples

### Basic example

Use `backdropOpacity(n)` with another backdrop filter to set how strongly the filtered backdrop shows, from `0` to `1`:

```tsx
<div mix={[...]}>
	<div mix={[...]}>
		<div mix={[backdropInvert(), backdropOpacity(0.25), ...]}>
			backdropOpacity(0.25)
		</div>
	</div>
	<div mix={[...]}>
		<div mix={[backdropInvert(), backdropOpacity(0.5), ...]}>backdropOpacity(0.5)</div>
	</div>
	<div mix={[...]}>
		<div mix={[backdropInvert(), backdropOpacity(0.75), ...]}>
			backdropOpacity(0.75)
		</div>
	</div>
</div>
```

## Applying on a state

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

```ts
u.hover(u.backdropOpacity())
```

## Responsive design

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

```ts
u.at("md", u.backdropOpacity())
```

## Signature

```ts
u.backdropOpacity(value?: number | (string & {}))
```
