general
if
Conditionally returns input, or a falsy value when condition is falsy.
import { if } from "@sdxc/u/general";Examples
Calls that compose other mixins rather than emitting declarations of their own.
u.if(isActive, u.bg("brand.tint"))isActive ? u.bg("brand.tint") : falseUsing a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.if(isActive, u.bg("brand.tint"))Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.if(isActive, u.bg("brand.tint")))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.if(isActive, u.bg("brand.tint")))Signature
u.if(condition: unknown, input: UtilityInput<Node>)