effects
backdropOpacity
Fades what shows through the element's translucent background, taking CSS's native 0–1 range or a percentage string.
import { backdropOpacity } from "@sdxc/u/effects";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: "..." } }) |
Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.backdropOpacity()Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.backdropOpacity())Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.backdropOpacity())Customizing the theme
The custom properties this utility reads, which a theme redefines.
| Variable |
|---|
--ui-backdrop-opacity |
Signature
u.backdropOpacity(value?: number | (string & {}))