Hi, I want to use the built in form builder blocks (fields) in my own custom blocks that uses the form builder block fields. Is there a way to import them to use, I can’t seem to figure it out. For example I want to have a form section block with text etc that lets me add form builder fields. I was able to do it by adding an array field with the name of each form field I want in the section, but that’s not very user friendly for end users. Thanks
This is how I achieved it:
import { Block } from 'payload/types';
import richText from '../fields/richText';
const FormField = {
title: "title",
}
type FormField = (typeof FormField)[keyof typeof FormField];
const FormLink: Block = {
slug: 'formLink',
labels: {
singular: 'Form',
plural: 'Forms',
},
fields: [
{
name: FormField.title,
type: "text",
},
richText,
{
name: "form",
label: "Form",
type: "relationship",
relationTo: "forms"
},
],
};
export default FormLink;thanks I’ll try that out, didn’t even think about using a relationship
thanks again for the suggestion, tried it out and that works for my purposes.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.