Help with Streamlit Component Heights?

Hi,

Quick question: Any tips on adjusting the height of Streamlit components? I’m working on a project and would love to hear your insights or best practices.

Thanks a bunch!

Hi @Fatemeh_Norouzi,

Thank you for sharing your question with the community!

Your post is missing a code snippet and a link to your app’s GitHub repo. Please check out our guidelines on how to post an effective question here and update your post to help the community answer your question.

Hi @Fatemeh_Norouzi

As @tonykip had pointed out, it would be great if you also share your code snippet so that the community can see exactly the issue that you’re encountering.

Guessing from the limited information on adjusting the height of Streamlit component, are you referring to the html component functionality, by default the height parameter is set to 150 pixels, thus you can adjust this number to a height that best display the underlying page content that you are displaying.

More info here in the Docs page:
Components API - Streamlit Docs

1 Like

Hello, appreciate your response. I’m not referring to HTML; I’m discussing Streamlit elements such as st.multiselect. Here’s my code, and I’m looking to adjust the height of “day_of_week” so that it matches the uniformity of the other elements.

    for i in range(station_num):
        container_1 = st.container()
        with container_1:
            print(container_1.write('this is the container1'))
            name_station, num_charging, name_charging, day_week, arrive_time, stay_l,  = st.columns(6)
            with name_station:
                station_name = st.text_input(f"Station{i+1} Name:", value=f"Station {i+1}",key=f'station_name_{i}')
            with num_charging:
                charging_number = st.number_input(f"Charging station number:", min_value=1, value=2, step=1, key=f'charging_station_number_{i}')
            charging_stations = []
            for j in range(charging_number):
                    with name_charging:
                        charging_station_name = st.text_input(f"Charging Station Name:", value=f"Station {j+1}",key=f'charging_station_name_{i}_{j}',help="charging number")
                    with day_week:
                        options_week_day = ['Monday','Tuesday','Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
                        day_of_week = st.multiselect(f'week day(s):', options_week_day, default=['Sunday'],key=f'day_of_week_{i}_{j}')