state
has
Sugar over when("&:has({selector})", input).
import { has } from "@sdxc/u/state";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.has("input:user-invalid", u.border("danger")) | css({ "&:has(input:user-invalid)": { borderColor: "..." } }) |
u.has("img", u.p(4)) | css({ "&:has(img)": { padding: "..." } }) |
Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.has("input:user-invalid", u.border("danger"))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.has("input:user-invalid", u.border("danger")))Signature
u.has(selector: string, input: UtilityInput<Node>)