Issue with Creating Custom Separator Field Based on GroupElement #109
-
Hi VueFormBuilder Team, I am working on extending the groupElement to create a new field called separator for form sections. However, I am facing a couple of issues: When I define the new field with type: "separator", I am unable to drag and drop default fields into it. Here is my current configuration: javascript separator: {
label: "Separator",
type: "separator",
description: "A separator for form sections",
icon: "https://fr.eudonet.com/wp-content/uploads/2024/04/logo-eudonet-blanc-rouge.svg",
category: "structure",
schema: {
type: "group",
},
component: SeparatorElement,
sections: {
...elementTypes.container.sections,
main: {
label: "General",
properties: {
label: {
type: "text",
label: "Label",
default: "New Separator",
},
},
},
},
separators: elementTypes.container.separators,
} I’m trying to extend the groupElement and use the type separator. Could you please help me understand how to achieve this? Specifically, I want to use a custom separator function with the type separator, but also ensure that the builder JSON reflects this change (and allows the fields to be draggable). Thank you for your support! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
FIrst, you have to register your Then you can use the separator: {
label: "Separator",
type: "separator",
description: "A separator for form sections",
icon: "https://fr.eudonet.com/wp-content/uploads/2024/04/logo-eudonet-blanc-rouge.svg",
category: "structure",
schema: {
type: "separator",
},
sections: {
...elementTypes.container.sections,
main: {
label: "General",
/*
// This isn't the right way of creating custom config fields
properties: {
label: {
type: "text",
label: "Label",
default: "New Separator",
},
},
*/
},
},
separators: elementTypes.container.separators,
} Defining custom config options for this element (on the right side panel when the element is clicked) can be done according to this docs: https://builder.vueform.com/docs/custom-config-panels I'm not sure about how groups relate to this, but if you are happy to provide more info on this new element type or maybe a sketch of how it looks like I'm happy to guide you further. |
Beta Was this translation helpful? Give feedback.
Thanks for the explanation, now I understand what you are looking to achieve.
Question: how essential is it for you to have the
type
asseparator
? I'm asking because creating new container types (likegroup
andobject
) is currently not supported in the builder. So if that's a must it's something that needs to be implemented from the builder side first — I dropped it into the idea pool because it might be useful for others as well.Currently what you can do is to create an alternative view for the
group
orobject
element type (group
doesn't nest data,object
does) and define yourseparator
element'sschema
like this:The next thing you need …