Skip to content

Mounted Form

mountForm returns a MountedForm. Keep it when the host app needs cleanup, direct engine access, or design system updates.

Property or methodTypePurpose
formFormControllerRead values, validate, submit, reset, or subscribe.
hostHTMLElementMounted primitive host element.
engineRegistryRegistryField and report definitions used by this instance.
primitiveRegistryPrimitiveRegistryRenderer mapping used by this instance.
designSystemRegistryDesignSystemRegistryTheme and recipe registry.
designSystemAttachedDesignSystemAttached stylesheet/controller.
updateDesignSystem(config)voidMerge design system changes.
replaceDesignSystem(snapshot)voidReplace mode, theme, recipe, and overrides.
resetDesignSystem()voidRestore kit defaults.
unmount()voidAbort submit, disconnect styles, and remove the host.
const mounted = mountForm(container, {
transport: createJsonTransport({ endpoint: "/api/predict" }),
schema,
});
mounted.form.subscribe((state) => {
console.log(state.status, state.valid);
});
window.addEventListener("beforeunload", () => mounted.unmount());

Calling mountForm again on the same container unmounts the previous MLForm instance before mounting the next one.