sheet()
Generate scoped class names from JavaScript objects. Auto-injects a <style> tag.
Signature
Section titled “Signature”function sheet<T extends SheetDef>(definitions: T): SheetResult<T>Parameters
Section titled “Parameters”| Param | Type | Description |
|---|---|---|
definitions | T | Object mapping class names to CSS rules |
Returns
Section titled “Returns”Object where each key is a scoped class name string. Also includes a .cls() helper.
Examples
Section titled “Examples”import { sheet, div, h2, p } from "@whisq/core";
const s = sheet({ card: { padding: "1.5rem", borderRadius: "12px", background: "#fff", "&:hover": { background: "#f5f5f5" }, }, title: { fontSize: "1.25rem", fontWeight: 600 },});
div({ class: s.card }, h2({ class: s.title }, "Hello"), p("World"))