Adjusting height between columns

Hi Streamlit team,

Iโ€™m working in python, Iโ€™m using text input and save button to save what ever entered in text box. But the alignment between text bar and save button is not matching. i used st.column() to make them side by side. can you please help in adjusting save button to text input bar.

Also can you please help in how to implement a searchbar which shows suggestions loaded from a text file.

1 Like

Hi @Nanditha_Swamy,

Thanks for posting and welcome to the Streamlit Community Forum! :raised_hands:t5:

Hereโ€™s some CSS code that might help with aligning the button and text box on the columns:

import streamlit as st

col1, col2 = st.columns([5,1])

text_input = col1.text_input('Enter text here')
if col2.button('Save'):
    st.write(f'You entered: {text_input}')

    [data-testid="stHorizontalBlock"] {
        align-items: flex-end;

Can you provide more explanation for your second question about the search bar? Maybe an example would help. Be as detailed as possible.

Hi @tonykip ,

Thank you for the solution.

Second one i have made an alternative using st.selectbox() for now. if in future required, will let you know.


1 Like

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

Awesome! Glad it works.