I need to make a dynamic UI. Where when user clicks a button, then a textbox is added
Hey @priyam!
We answered this in our chat today but wanted to post this here for any other interested parties:
I believe the best way to do this would be to use a listview component.
To set this up, first I would create some temporary state in the left panel by selecting "Create new"
with this state selected, in the right panel I would give it an initial value of 1
This state will keep track of how many inputs to render.
Next, I would create a button and a listview with a text input inside of it:
Now with our listview selected, we can change the "Number of rows" input to reference our state value:
Now we just need to connect our button, with the button selected, we can add an event handler to increment the state like this:
Lastly, so that our values persist, we want to add the following code to the listviews "Row keys" input:
{{_.range(listView1.instances)}}
Hope this helps, let me know if you have any questions!