Skip to content

Architecture

MLForm is split into four public surfaces.

SurfaceImportResponsibility
Kitmlform or mlform/kitDefault mount path for applications.
Enginemlform/engineState, validation, registry, hooks, and submit flow.
Primitivesmlform/primitivesBuilt-in Web Components and primitive renderer registry.
Design systemmlform/design-systemThemes, recipes, token resolution, and host integration.

Use the kit for application code. Drop to engine or primitives only when building custom renderers, registries, or integration layers.

import { createJsonTransport, mountForm } from "mlform";
import type { FormSchema } from "mlform/engine";
const schema: FormSchema = {
fields: [{ kind: "text", label: "Prompt" }],
};
mountForm(container, {
transport: createJsonTransport({ endpoint: "/predict" }),
schema,
});