Form Legos

Form legos are composed of transaction legos and field legos. Once complete, a form can collect information from the user and trigger a transaction to a smart contract.

Github (opens in a new tab)



How to make a form lego

This form uses an existing tx lego. Learn about making new transaction legos.

This form uses a mix of existing field legos and one custom lego. Learn about making new field legos.


import { MolochFormLego } from '@daohaus/moloch-v3-fields';
import { TX, FIELD } from '@daohaus/moloch-v3-legos';
const simpleForm = {
  id: 'SIMPLE',
  title: 'Simple Title',
  subtitle: 'Simple Subtitle',
  description: 'Super simple description.',
  requiredFields: { title: true, simpleCustomField: true },
  log: true,
  fields: [
    { ...FIELD.TITLE, label: 'Simple Label' },
      id: 'simpleCustomField',
      type: 'textarea',
      label: 'Tell me something?',
      placeholder: 'Please?',
id Arbitrary identifier. Should be unique
titleMain form headline
titleSmall text above the title
titleParagraph below the title
txTransaction lego
fieldsArray of field legos
requiredFieldsAn object with the field id of any required fields
log If set to true the form builder logs out form values in the console for help during development
submitButtonTextOverrides the default submit button text ('Submit')