formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.84k stars 1.05k forks source link

[QUESTION] Trouble creating a custom component for the FormBuilder using Typescript #5674

Open frances-datacom opened 1 month ago

frances-datacom commented 1 month ago

Hi,

I'm having trouble using FormIO in React with Typescript. Please see this link: https://codesandbox.io/p/devbox/blissful-hill-7f9qfr

Here, I have a custom component called ImageDraw. It shows up in the sidebar, and can be dragged/dropped onto the FormBuilder. However, the edit dialog and the UI on the FormBuilder don't render properly. It seems that it is not picking up the builderInfo etc from the component. I am missing something here, and I don't know what.

Any help would be greatly appreciated.

image

image

ACmaster7 commented 1 month ago

Hi, you need to specify the type of the component as the key in the exports object like this:

export default { imagedraw: ImageDrawComponent, Header: HeaderComponent, };