DAOhaus v2
Form Lego

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.

See an example Form Lego (opens in a new tab) in the Mint a Million Tutorial

Form Blueprint

    id: 'MEMBER',
    title: 'Membership Proposal',
    description: 'Proposal for DAO membership',
    required: ['title', 'sharesRequested'], // Use name key from proposal type object
    fields: [
    additionalOptions: [
        label: 'Applicant',
    customValidations: ['nonDaoApplicant'],

This blueprint shows a few of the Form Lego features:

  • It specifies some basic info needed to render the form: id title description
  • It specifies the Proposal Type, which will impact how the resulting proposal renders in the app
  • It takes in a TransactionLego TX.SUBMIT_PROPOSAL to handle contract execution when the form submits.
  • It arranges the fields that appear on the form
  • It handles validation for which fields are required.
  • It specifies an entry in customValidations

Form Lego Parameters

ParameterData TypeDescription
idSTRINGUnique identifier for the form lego.
titleSTRINGSets the title that appears at the top of the form.
subtitleSTRINGSets the subtitle that appears at the top of the form.
descriptionSTRINGDisplays on the form to describe the purpose of the form
typeSTRINGWill be incorporated into the detailsToJSON data. Creates an easy way of discorvering what type of proposal is being passed to the app later on.
  • Takes an array of field.name(s). Before the proposal submits, it will iterate over this array and search for all the keys in the values object.
  • If any of these values are falsy, it will stop the transaction and return an error for each required field where the conditions have not been met.
  • Important: Make sure to use the value that is found in the field's name key. Otherwise the form will not submit.
  • txTX LEGO
  • Recieves a TX lego. This is the transaction that will be fired when the form submits.
  • If tx is empty, the form will throw an exception on submit.
  • fieldsARRAY OF FIELD LEGOSTakes in an array of Field data and the factory component renders these in order. Throws an exception if it doesn't find a field component for each field.type.
    additionalOptionsARRAY OF FIELD LEGOSAn array of field legos that can be selected on the 'Additional Options' dropdown on the form
    minionTypeSTRINGFor minion proposals. Adds minionType to the detailsToJSON field.
    customValidationsARRAY OF STRINGSCan check anything inside of the application. If you want to add a custom validation head to src/utils/validation.js
    ctaTextSTRINGCall To Action text. Or the name of the submit button on the form.
    blurTextSTRINGIf valdation isn't fulfulled this the is the text on the blur.
    formConditionsARRAY OF STRINGSCan change state of form based on specified condition.
    customWidthSTRINGSpecifies width of form modal (800px - example).
    logValuesBOOLEANTo log values of values of subject. Set to true debug.