general
var
Resolves a custom property reference: var(--{name}), or with a fallback, var(--{name}, {fallback}).
import { var } from "@sdxc/u/general";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.var("sidebar-width") | "var(--sidebar-width)" |
u.var("sidebar-width", "18rem") | "var(--sidebar-width, 18rem)" |
Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.var("sidebar-width")Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.var("sidebar-width"))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.var("sidebar-width"))Signature
u.var(name: string, fallback?: string)