How can I add components dynamically?

Hi, I'm back again with a question!

What I'm trying to make is a kind of a list view.
I have 2 buttons and each button should add component when it's clicked.

For example, button 1 should add textArea component when it's clicked,
and button 2 should add file input component when it's clicked.
It seems similar with the component called "List View".
But I couldn't find out how to add different type of components dynamically in the List View.

Anyone could help me figure this out?

Thanks all the time!

1 Like

Hi there @Jaemoon_Lee,

The approach I would take is:

  • Have a listView and a variable with my data as the data source for my listview
  • For that data, I would add, with a transformer or js, another property for each dynamic component within each object of my data. Each is a boolean
  • The buttons in the listView will then update the variable to true/false, and based on that set the hidden settings for that dynamic component
  • I would then use the variables state to know which component the user used, and map it (this info is accessible at the listView's instanceValues

I hope this helps!