Skip to content

Installation

Terminal window
npm install mlform

MLForm is an ES module package written in TypeScript. Its types ship with it. The built-in UI uses Lit Web Components and the schema contract uses Zod; both are installed as dependencies. Install them in your application too when your own code imports them, for example to write a custom field or a Zod schema for a custom kind.

The library runs in browsers that support Web Components. Node.js consumers, such as tests or tooling that imports the headless layers, need Node.js 20.19 or later.

Most applications import the kit from the package root:

import { mountForm } from "mlform";

mlform and mlform/kit are the same module. Import a layer directly when you only need that layer, for example headless state in a worker or a custom renderer:

import { createFormView } from "mlform/view";
import { createForm } from "mlform/runtime";
import { createBuiltinMlRegistry } from "mlform/builtins";

Package exports lists every surface and what it contains. Mental model explains how the layers fit together.

MLForm does not download fonts. Themes name their font families and fall back to system fonts. The eshkra theme used in these pages expects Mona Sans and JetBrains Mono; load them in your application if you use it. See Themes and recipes.

The repository uses Vite+ (vp) for installs, checks, tests, and builds. Library and playground CI runs on Node.js 24; this documentation site requires Node.js 22.18 or later.

Terminal window
vp install
vp check
vp run typecheck
vp test run
vp build

The documentation is a separate Astro Starlight project under docs/:

Terminal window
cd docs
vp install
vp run dev
vp run build