Skip to Content
LetsForm DesignerEmbeddable LetsForm Builder

Embeddable LetsForm Builder

Embed a full featured LetsForm builder in any site with a Web Component and programmatically capture the composed LetsForm JSON schema in JavaScript.

From the dashboard, click on “Create builder”

LetsFormDesigner: Create LetsForm Builder

then select which UI framework to use (i.e. React+RSuite5, React+AntD, etc), the form preview size and hit the button “Save”. Then click on “Embed this LetsForm Builder” to get the JavaScript code for installing it on any website.

Follow these installing instructions

Install the LetsForm Builder Web Component

Install the LetsForm Builder web component, copy the code below between the <head> tag of your html page

<script type="module" src="https://cdn.jsdelivr.net/npm/lets-form-builder@latest/builder.bundled.js"></script>

Mount the LetsForm Builder

Mount the LetsForm Builder in any point of your web page, paste the code

<letsform-builder height="600" id="my_builder" builderId="<my-builder-id>" emptyForm="true" />

Each saved LetsForm Builder has its own builderId.

Listen to changes to the form

Each time a changes is made in the form of the LetsForm Builder, an event lf-form-changed is triggered on the Web Component, the event payload contains the LetsForm JSON Schema which can be used by any <LetsForm /> component

<script type="module"> document.getElementById('my_builder') .addEventListener('lf-form-changed', event => { console.log('LetsForm JSON Schema: ', event.detail); }); </script>

Preload an existing LetsForm JSON schema in the builder

To edit an existing LetsForm JSON Schema in the builder, just use the .loadForm() method:

<script type="module"> document.getElementById('my_builder') .loadForm({ "version": 2, "fields": [ // some fields ] }); </script>

The LetsForm Builder is loaded into an iframe, you don’t have to wait for the iframe to be loaded completely, the Web Component will do it for you.

Listen to “Save form” event

To programmatically capture the LetsForm JSON Schema from the Builder, you can either listen to the change event lf-form-changed (triggered on any changes) or lf-form-saved (only triggered when the user clicks on the “Save form” icon in the Builder).

<script type="module"> document.getElementById('my_builder') .addEventListener('lf-form-saved', event => { console.log('LetsForm JSON Schema: ', event.detail); }); </script>

The “Save form” button can be disabled in the “Settings” section.

Restrict LetsForm Builder to some domains

LetsForm Builders can be restricted to run on specific domains to avoid abuse. Click on “Settings” and enter a list of allowed domains, follow these guidelines on how to specify domains (i.e. http://localhost:3000, https://my.domain.it, etc).

Custom components in LetsForm Builder

LetsForm Builders components palette can be customized with forms or pre-configured fields fed by one or more projects.

This allows to make available to your users, preconfigured fields based on your application domain.

Make project public

Projects to be used in LetsForm builders palette need be “public”, this makes forms of the project available to the external users of LetsForm Builder (not signed in to LetsForm Designer).

Enter project detail, click on “Edit” and select visibility “Public”.

LetsFormDesigner: Make project public

Select projects

Select which public projects may appear in the draggable section of the sidebar: click on “Settings” and expand the drop down menu “Custom components” (only public projects will be listed here)

LetsFormDesigner: Make project public

LetsForm Builder Web Component

Properties of <letsform-builder> Web Component

PropertyTypeDescription
builderIdstringThe builderId to be embedded. Required
widthnumberWidth of form builder
heightnumberHeight of the form builder
startWithEmptyFormbooleanStarts with an empty form. If false, UI shows a loader while waiting for a form to be loaded with .loadForm(). Default: true

Available events

Event anmeArgumentsDescription
lf-form-changedLetsForm JSON SchemaTriggered on every JSON schema changes in the LetsForm Builder
lf-form-savedLetsForm JSON SchemaTriggered when the user hits the “Save” button in the LetsForm Builder
lf-form-readyn/aTriggered when the LetsForm Builder is loaded and ready

Available methods

Event anmeArgumentsDescription
clearFormClear the form in the Form Builder
loadFormLetsForm JSON SchemaLoads a form in the Form Builder