Skip to content

sheet()

Generate scoped class names from JavaScript objects. Auto-injects a <style> tag.

function sheet<T extends SheetDef>(definitions: T): SheetResult<T>
ParamTypeDescription
definitionsTObject mapping class names to CSS rules

Object where each key is a scoped class name string. Also includes a .cls() helper.

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"))