Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ability to Set Default Sidebar Width #11980

@jose-mindwayai

Description

@jose-mindwayai

Checklist

  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.

Summary

Add the ability to configure the default sidebar width in config.toml.

Why?

The default sidebar width was changed in Streamlit 1.46.0, which can affects apps that rely on a wider sidebar for layout consistency. In my case, I have buttons and other elements in the sidebar that now appear squished with the new default.

While it’s possible to override the sidebar width using custom HTML like:
[data-testid="stSidebar"] { width: 400px; } or

[data-testid="stSidebar"] { min-width: 400px; max-width: 800px; } this approach has limitations.

It might not persist smoothly across pages in multipage apps if you reload the sidebar — making it flashe from default to custom width on every navigation. Also, it seems more like a workaround rather than a native solution.

How?

Ideally, it would be nice to support a config option such as:

sidebar-default-width = 400 # width in px

Additional Context

Related code:

Related discussions:

https://discuss.streamlit.io/t/release-1-46-0/115727/7

https://discuss.streamlit.io/t/specify-sidebar-width/45866

#2058

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.sidebarRelated to `st.sidebar` containertype:enhancementRequests for feature enhancements or new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions