Stacking UI Elements in a canvas dynamically

I have created multiple UI component prefabs (Texts with a specific font, size, Radio button groups, etc.) and I’m attempting to read a JSON file that has UI data that I would then like to append to the canvas based on the format required.

    //sectionPreabs is a list that contains different UI components I've made
    GameObject prefab = Instantiate(sectionPrefabs[0]);
    //sectionContainer is a panel in the canvas
    prefab.transform.SetParent(sectionContainer.transform);
    //set the data to the prefab's text component
    prefab.GetComponent<TextMeshProUGUI>().text = section.text_content;

For example, if the JSON says “type: heading”, I would append a heading text prefab I’ve created. I’ve already written the script that appends these components to my canvas. However, when appending multiple prefabs below each other, the components are instantiated in weird positions on the screen. Is there a way to stack them in a list?

I would also love to have this list be scrollable so that all the components that were appended can be viewed in order.

Thank you in advance!

Solved it by using this tutorial: