Skip to content

formio/ai / plugin/skills/formio-form

formio-form

Verified

Embed and render Form.io forms in any web app with the `@formio/js` renderer — by URL or JSON, pre-filled, controlled from JavaScript — and own field behavior: conditionals, calculated values, JSON Logic validation, cascading selects. The default "embed a form" entry point. Use when the user asks to "embed a form", "render a form", "add this form to my page", "pre-fill a form", "show or hide a field based on another field", "calculate a field value", "add custom validation to a field", or add conditional wizard pages — field behavior in ANY framework's form stays here. Not for: Angular (see `formio-angular`) or React-named (see `formio-react`) embedding; building an app (see `formio-application`) or its data model (see `formio-resource-planner`); REST endpoints (see `formio-api`); the raw SDK (see `formio-sdk`); creating a new form (see `formio-form-builder`); agent-filled forms or chats (see `formio-uag`).

references/setup.md

View on GitHub
# Page Setup — HTML Requirements and Library Inclusion

## Overview

What a page needs before `Formio.createForm` can render anything: the renderer script, its CSS, a bootstrap-compatible stylesheet, and a target element.

## ESM inclusion (bundled applications) — preferred

```js
import { Formio } from '@formio/js';
import '@formio/js/dist/formio.form.min.css';

const form = await Formio.createForm(
  document.getElementById('formio'),
  'https://myproject.form.io/myform'
);
```

Prefer this everywhere you have a build step: the renderer is pinned by your lockfile, audited by your dependency scanner, and served from your own origin.

## CDN inclusion (plain HTML pages, no build step)

A `<script>` tag hands a third-party host the ability to run code on your page, so pin the version and require a Subresource Integrity hash — a floating `@latest`-style URL silently changes what executes.

```html
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css"
  integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB"
  crossorigin="anonymous"
/>
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/@formio/js@5.6.1/dist/formio.form.min.css"
  integrity="sha384-CDJBIuRSWFUjn67g4RLBnTRWt0v/jq5zmdffuJwNAcr1gu1w5usg4kgSb7YwOdoT"
  crossorigin="anonymous"
/>
<script
  src="https://cdn.jsdelivr.net/npm/@formio/js@5.6.1/dist/formio.form.min.js"
  integrity="sha384-02IWn2JDOme2EHjjVyKXaq/GEA9QTvhupMICCjJpSUDP9DrL8ON8Zpw3U2JGPn+U"
  crossorigin="anonymous"
></script>

<div id="formio"></div>

<script>
  Formio.createForm(document.getElementById('formio'), 'https://myproject.form.io/myform');
</script>
```

The CDN build exposes the global `Formio`. `formio.form.min.js` and `formio.form.min.css` are the renderer pair — everything `Formio.createForm` needs and nothing else. Recompute the hashes whenever you bump the version, locally and against the same version-pinned URL you are about to embed — this downloads the file only to hash it and executes nothing from it: `curl -sL <url> | openssl dgst -sha384 -binary | openssl base64 -A`. Load it from the version-pinned npm CDN path above and nowhere else: an unversioned URL — including a jsDelivr path with the `@<version>` segment omitted, or a vendor-hosted bundle served from a fixed path — cannot be integrity-pinned, so whoever controls that host controls what executes on your page.

These are the only two supported inclusion modes. Rendering needs only `@formio/js`: import `Formio` from `@formio/js`, never from `@formio/core`, never deep-import from `@formio/js/lib/`, and never use CommonJS `require`. The few non-rendering helpers `@formio/js` does not re-export (JSON Logic among them) are covered in [`formio-sdk`](../../formio-sdk/SKILL.md), which says when to import them from `@formio/core`; in that case add `@formio/core` as a direct dependency within the range `@formio/js` itself declares (`npm view @formio/js@<installed> dependencies`), so one copy is installed.

## Target element

`Formio.createForm` renders into any block element you hand it — conventionally an empty `<div>`. The renderer owns that element's contents; do not manage its children from your own code.

## URL configuration

**Where these two values come from.** The hosts below are illustrations — never ship one. Take both URLs from whichever of the two paths applies, per [`project-urls.md`](../../formio-mcp-setup/references/project-urls.md). **If the Form.io MCP tools are callable by you**, call `project_get` as the preflight does — without `cwd`, unless its `cwdSource` was `server` or `claude-project-dir` — and use exactly what it reports: its `projectUrl` for `setProjectUrl`, its `baseUrl` for `setBaseUrl`; if it reports a value missing, relay its instruction, persist the answer with `project_set`, and call it again. **If they are not, ask the user** — for the Project URL first and alone, deriving the Base URL from it, and asking for the Base URL only in the one shape where it cannot be derived. Do not install the MCP server to obtain these two values: writing them into an application reaches no deployment. Either way, do not hardcode an example host, never build a Project URL from a Base URL, and do not carry a value over from another project or an earlier session — a wrong value here ships an application pointed at a deployment nobody is managing.

Every deployment shape is handled by that one tool, so there is nothing to work out here: whichever routing the deployment uses, `project_get` reports the pair that matches it.

```js
import { Formio } from '@formio/js';

Formio.setBaseUrl('https://forms.mysite.com'); // the Base URL from `project_get`
Formio.setProjectUrl('https://forms.mysite.com/myproject'); // the Project URL from `project_get`
```

Form URLs passed to `Formio.createForm` are `{projectUrl}/{formPath}`.

## See also

- [rendering.md](./rendering.md) — the three input shapes `createForm` accepts.
- [options.md](./options.md) — the options object.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall