styles()
Create a reactive inline style string from a JavaScript object.
Signature
Section titled “Signature”function styles(def: ReactiveStyleDef): string | (() => string)Parameters
Section titled “Parameters”| Param | Type | Description |
|---|---|---|
def | ReactiveStyleDef | Object mapping CSS properties to values or reactive functions |
Examples
Section titled “Examples”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")