Getting Started

Getting started

LetsForm uses native components of supported UI libraries (i.e. React, RSuite, AntD, etc), in order to reduce the compiled bundle, each framework has a different build

Install LetsForm

npm i lets-form -D

then try a simple form with just one text field (or use the LetsForm Designer (opens in a new tab) to create one)

import React from 'react';
import LetsForm from 'lets-form/react;
 
// copied and pasted from LetsForm Designer
const MY_FORM = {
  "$schema": "https://unpkg.com/lets-form/schemas/react/form.json",
  "version": 1,
  "layout": "vertical",
  "validationMode": "onSubmit",
  "fluid": true,
  "fields": [
    {
      "component": "input-text",
      "label": "My Field",
      "name": "my_field"
    }
  ],
  "name": "Simplest example"
};
 
const MyView = () => {
  return (
    <LetsForm
      form={MY_FORM}
      // or onChange
      onSubmit=(values => {
        console.log('Submitting...', values);
      })
    />
  );
}

The form will look like this

Loading...

Try to fill in the form and click "Submit", then inspect the values returned by onChange and onSubmit callbacks.