Change width of sidebar

Hi there,

I would like to show an image in the sidebar. Like this, the image can be viewed while scrolling through the app.

Can the width of the sidebar be increased such that the complete image is visible in a reasonable size? It is possible to set the width of the image to make it smaller but this makes it difficult to read information from the image.

Any help is very much appreciated!

Cheers, Lili

2 Likes

Hi!

I am having the same problem, but I want to print a small table (5 columns) onto the sidebar without scrolling right.

@thiago How can we do it?

Thanks!

Hi @lnros . There is currently no official way to set the sidebar width, but if you search the forums you’ll find some hacks people have created.

In the meantime, please follow this feature request I just created so you’re notified if/when we implement this! https://github.com/streamlit/streamlit/issues/2058

1 Like

I was able to change the sidebar width this way:

st.markdown(
    f'''
        <style>
            .sidebar .sidebar-content {{
                width: 375px;
            }}
        </style>
    ''',
    unsafe_allow_html=True
)

It does work @Larrypc, but it messed up sidebar UI, even after collapsing it, we can still see it.