New API: st.set_page_config
See original GitHub issueProposal
st.set_page_config(
layout="centered", # Can be "centered" or "wide". In the future also "dashboard", etc.
initial_sidebar_state="auto", # Can be "auto", "expanded", "collapsed"
page_title=None, # String or None. Strings get appended with "• Streamlit".
page_icon=None, # String, anything supported by st.image, or None.
)
Background
We want to support the following in Streamlit:
- Ability to set page favicon
- Ability to set page title
- Ability to make a page start in wide mode (today you need to toggle it in “preferences”)
- Ability to make a page start with the sidebar collapsed (today you need to collapse via the UI)
Must be first st command
For all of these settings, we’d prefer if the user sets them near the top of their script. Because it would be weird to have an app load, then show a bunch of stuff, and then change into wide mode, for example.
Immutable, for now
For title and favicon, it makes a lot of sense to support mutation. But it’s not what 99% of the users will be doing, so it’s OK if we don’t support it at first. For wide-mode and expand-sidebar, mutations make a lot less sense.
(Copied from our internal spec here)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:12
- Comments:7 (2 by maintainers)
Top Results From Across the Web
st.set_page_config - Streamlit Docs
Configures the default settings of the page. Note. This must be the first Streamlit command used in your app, and must only be...
Read more >Streamlit Pages Configuration - YouTube
Let's see how to deal with Streamlit pages configuration, Streamlit footer, burger menu, favicon, app title, etc.
Read more >Street View Service | Maps JavaScript API - Google Developers
On this page ... When you add a Street View control to the map by setting its streetViewControl option to true ... const...
Read more >API Reference Home | Zendesk Developer Docs
This is the complete collection of Zendesk APIs. Run in Postman. Capabilities. Ticketing. Work with tickets, users and organizations and manage ticket workflows ......
Read more >Configure Grafana | Grafana documentation
Do not use environment variables to add new configuration settings. ... This setting also provides some protection against cross-site request forgery ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anybody who arrived here and is looking for the fix:
streamlit.set_page_config(page_title=None, page_icon=None, layout=‘centered’, initial_sidebar_state=‘auto’)
Configures the default settings of the page. Note: This must be the first Streamlit command used in your app, and must only be set once. Parameters • page_title (str or None) – The page title, shown in the browser tab. If None, defaults to the filename of the script (“app.py” would show “app • Streamlit”). • page_icon (Anything supported by st.image or str or None) – The page favicon. Besides the types supported by st.image (like URLs or numpy arrays), you can pass in an emoji as a string (“”) or a shortcode (“🦈”). If you’re feeling lucky, try “random” for a random emoji! Emoji icons are courtesy of Twemoji and loaded from MaxCDN. • layout (“centered” or “wide”) – How the page content should be laid out. Defaults to “centered”, which constrains the elements into a centered column of fixed width; “wide” uses the entire screen. • initial_sidebar_state (“auto” or “expanded” or “collapsed”) – How the sidebar should start out. Defaults to “auto”, which hides the sidebar on mobilesized devices, and shows it otherwise. “expanded” shows the sidebar initially; “collapsed” hides it.
Hi @benlindsay, sorry we had some issues with the nightly over the past weekend but we just shipped out a release yesterday so you should be able to use this feature if you upgrade to the latest Streamlit version(0.65)!