Design
Forms
Build a form visually with fields, sections, steps, rules and a live preview, then save it into your page as a React component.
Use the form builder to design a form without writing code: pick fields, set their rules, try the form live, then save it into your page. Lyna writes a self-contained component with its validation.
What you can do
- Start from a blank form, a template or one of your forms.
- Add fields, and arrange them in half-width rows, sections and steps.
- Set labels, helper text, placeholders, rules and their error messages.
- Show a field only when another answer matches.
- Choose where the answers go, the form's style and its spam protection.
- Try the form in a live preview, on a desktop or a phone size.
- See and copy the generated code.
- Edit a saved form later, wherever it is on your pages.
Build a form
Open the form builder
Hover the gap between two rows in Layers and choose the form button next to +, pick a card in the Forms category of the block picker, or choose Add form in the command palette (
Cmd/Ctrl + K). The builder opens on Start a form: choose Blank form under New form, a template under Templates (Sign up, Log in, Contact, Newsletter, Checkout address or Feedback), or a form under Your forms.Add fields
In the Fields panel, the Add tab lists the fields: drag one onto the form, or click it to add it. Type in Search fields to find one.
Group Fields Text Text, Email, Website, Phone, Number, Password, Long text Choices Dropdown, Radio group, Checkbox group, Combobox Controls Checkbox, Switch, Slider, Date Outline shows the order of the form and Steps its steps. Add section and Add step group fields under a title.
Set each field
Select a field to edit it in Properties:
- Field: the Label, Field name, Helper text, Placeholder and whether it is Required. Choice fields have Options you can add and remove.
- Layout: the Width, Full width or Half width. Two half-width fields side by side share one row.
- Rules: limits such as Minimum length, Maximum length, Smallest number, Largest number, the Earliest date or the Latest date, and a Format (Any text, Phone number, Web address or Custom pattern). Each rule can have its own Error message.
- Show when: show the field only when another answer matches.
Set the form
Choose the title in the header to rename the form (Rename the form). In Form settings, set the Description, the Submit button text, the Component name, the Success message and the Message language. Under When someone submits, pick Where the answers go: Decide later, Send to my address or Save to my database table. Pick a Style (Minimal, Card or Bordered) and turn on Spam protection if you like. See submissions opens the answers the form received.
Try it
Switch the Mode from Edit to Try it and fill in the form as a visitor would. The preview checks your rules, and nothing is sent. Preview size shows it at Desktop or Phone size.
Save it
Choose Save (
Cmd/Ctrl + Enter), or Save changes on a form you are editing. Lyna installs the packages the form needs, writes the component and puts it where you opened the builder: at the insert point or by the selection, or at the end of the page when nothing is selected. Cancel closes the builder.
The generated code
Switch the Mode to Code to read the component, a React component in TypeScript that checks each field against your rules. Choose Copy code to copy it.
Your forms
Closing the builder keeps your form as a draft, and Cmd/Ctrl + S saves a draft at any time. The header shows whether your changes are saved. Your forms, on Start a form, lists your forms, each with a badge: Draft, the pages it is on, or On no page. Choose a form to edit it, or its trash button to delete it after you confirm.
To change a form already on a page, select it and choose Edit form in the right-click menu or in More in the element toolbar, then Save changes: the form is updated in place. After the first save, the component name is locked so the file stays stable. Deleting a saved form does not remove the forms already on your pages.
Related
Need help?
Ask the team, read what changed, or learn from the blog.