Adjust length of text input

Summary

I am looking to shorten the length of text input but how can I do it, I have attached the code below for refereence

Steps to reproduce

Code snippet:

with st.container():
        st.title('Recommender System')
        st.markdown("Provide username below to generate recommendation!")
        # empty line
        st.write("")
        st.write("")

username = st.text_input('Username') 
history= st.file_uploader('Viewing History', type=['csv'])

I want both username and history to have shorter length

Hi there, to make the text inputs appear with a shorter length, you can adjust it via st.column:

row_input = st.columns((2,1,2,1))
# username input at column 1
with row_input[0]:
    # username input
    username = st.text_input('Username') 
            
    with row_input[2]:
        # netflixhistory input
        history= st.file_uploader('Viewing History', type=['csv'])

The layout is spread into 4 columns, row_input = st.columns((2,1,2,1)) you can adjust the length with the numbers at each column.
Hope this helps!

1 Like

thank you for the help, i am looking to create two rows but this works as well. thank u!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.