sdxc

Type to search, or start from one of these:

state

precededBy

Sugar over when(":is({selector}) ~ &", input), the backward-looking twin of hasSibling().

import { precededBy } from "@sdxc/u/state";

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.precededBy("input:checked", u.border("brand.solid"))css({ ":is(input:checked) ~ &": { borderColor: "var(--ui-brand-bg-solid)" } })
u.precededBy("input:focus-visible", u.outline({ color: "brand", offset: 2 }))css({ ":is(input:focus-visible) ~ &": { outlineColor: "...", outlineOffset: "2px" } })

Using a custom value

Every scale argument also takes a raw CSS value, which passes through untouched.

u.precededBy("input:checked", u.border("brand.solid"))

Responsive design

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

u.at("md", u.precededBy("input:checked", u.border("brand.solid")))

Customizing the theme

The custom properties this utility reads, which a theme redefines.

Variable
--ui-brand-bg-solid

Signature

u.precededBy(selector: string, input: UtilityInput<Node>)