Generate multiple 'text-input's one after another

Hello! :wave:t2:
I want to create a ‘table’, which starts with a single text-input, and, as the user inputs text in it, another text-input is generated below it, sequentially. Tried this but the second text-input keeps getting replaced. Help/tips are appreciated :slight_smile:

spaces = -1

def get_spaces():   # function used to generate unique 'blank' labels for the text-inputs
    global spaces
    spaces += 1
    return ' ' * spaces
    
code1 = col1.text_input('CODE')
if code1:
    code2 = col1.text_input(get_spaces())
    if code2:
        code3 = col1.text_input(get_spaces())
        if code3:
            cod4 = col1.text_input(get_spaces())