Skip to content

styles()

Create a reactive inline style string from a JavaScript object.

function styles(def: ReactiveStyleDef): string | (() => string)
ParamTypeDescription
defReactiveStyleDefObject mapping CSS properties to values or reactive functions
import { signal, styles, div } from "@whisq/core";
const dark = signal(false);
div({
style: styles({
padding: "1rem",
background: () => dark.value ? "#111" : "#fff",
color: () => dark.value ? "#fff" : "#111",
}),
}, "Content")