h()
Create an element by tag name. Use h() for web components, SVG, custom tags, or any element not covered by the named element functions (div(), button(), etc.).
Signature
Section titled “Signature”function h( tag: string, props?: Props, ...children: Child[]): WhisqNodeParameters
Section titled “Parameters”| Param | Type | Description |
|---|---|---|
tag | string | Tag name ("div", "my-component", "circle") |
props | Props | Optional props object — same shape as named elements |
children | Child[] | Child nodes, strings, or reactive getters |
Examples
Section titled “Examples”import { h, signal } from "@whisq/core";
// Web componenth("color-picker", { value: () => selectedColor.value, onchange: (e) => (selectedColor.value = e.target.value),});
// SVGh("svg", { viewBox: "0 0 24 24", width: "24", height: "24" }, h("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),);
// Dynamic tag nameconst tagName = "section";h(tagName, { class: "card" }, "Hello");See Custom Elements for web-component, SVG, and wrapper patterns.