Without JSX
Build views with h() when you cannot use JSX.
Prefer JSX. When a file cannot use the JSX runtime, call h():
import { const atom: AtomFnatom, const h: HFnh } from "ilha";
const const Counter: () => VNodeCounter = () => {
const const count: AtomHandle<number, number>count = atom<number>(init: number | Atom<number>, options?: AtomOptions<number> | undefined): AtomHandle<number, number> (+2 overloads)An existing Effect atom, or a plain value. Store a function with
`atom.lazy(() => fn)`; the `ilha/oxlint` rule `function-in-atom` flags
`atom(fn)`.atom(0);
return h<"button">(type: "button", props: ButtonHTMLAttributes | null | undefined, ...rest: View[]): VNode (+2 overloads)h(
"button",
{
type?: string | undefinedtype: "button",
EventProps<HTMLButtonElement>.onclick?: ((event: Targeted<HTMLButtonElement, MouseEvent>) => void) | undefinedonclick: () => const count: AtomHandle<number, number>count.AtomHandle<number, number>.update: (f: (current: number) => number) => voidupdate((n: numbern) => n: numbern + 1),
},
"count: ",
const count: AtomHandle<number, number>count
);
};
h(type, props, ...children) is the same factory JSX uses. There is no html tagged template in this API.
h() is type-checked like JSX: intrinsic tags accept exactly their JSX props, so an unknown tag, a misspelt attribute, or a wrongly typed handler is a compile error here too. Custom elements (my-widget) still take any props.
Tagged templates
If you want markup that looks like the old html tagged-template helper, look at @knighted/jsx. It is a tagged-template JSX runtime. It is not built into Ilha.
It is compatible with Ilha only if the tag emits h() vnodes ($$ilha: 1), not DOM nodes or React.createElement. The package defaults to React; override its createElement / fragment to h and Fragment from ilha if that option exists in the version you install.
Use lowercase event props (onclick, not onClick). Ilha only binds all-lowercase on* keys. class and className both work.
Prefer real JSX or h() for anything you ship. Treat @knighted/jsx as an optional authoring layer, not part of the Ilha contract.