Configures the default settings of the page.

Note

This must be the first Streamlit command used on an app page, and must only be set once per page.

Function signature[source]

st.set_page_config(page_title=None, page_icon=None, layout="centered", initial_sidebar_state="auto", menu_items=None)

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 (except list), str, or None)

The page favicon. If page_icon is None (default), the favicon will be a monochrome Streamlit logo.

In addition to the types supported by st.image (except list), the following strings are valid:

  • A single-character emoji. For example, you can set page_icon="🦈".

  • An emoji short code. For example, you can set page_icon=":shark:". For a list of all supported codes, see https://share.streamlit.io/streamlit/emoji-shortcodes.

  • The string literal, "random". You can set page_icon="random" to set a random emoji from the supported list above. Emoji icons are courtesy of Twemoji and loaded from MaxCDN.

  • An icon from the Material Symbols library (rounded style) in the format ":material/icon_name:" where "icon_name" is the name of the icon in snake case.

    For example, icon=":material/thumb_up:" will display the Thumb Up icon. Find additional icons in the Material Symbols font library.

Note

Colors are not supported for Material icons. When you use a Material icon for favicon, it will be black, regardless of browser theme.

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", "expanded", or "collapsed")

How the sidebar should start out. Defaults to "auto", which hides the sidebar on small devices and shows it otherwise. "expanded" shows the sidebar initially; "collapsed" hides it. In most cases, you should just use "auto", otherwise the app will look bad when embedded and viewed on mobile.

menu_items (dict)

Configure the menu that appears on the top-right side of this app. The keys in this dict denote the menu item you'd like to configure:

  • "Get help": str or None
    The URL this menu item should point to. If None, hides this menu item.
  • "Report a Bug": str or None
    The URL this menu item should point to. If None, hides this menu item.
  • "About": str or None
    A markdown string to show in the About dialog. If None, only shows Streamlit's default About text.

The URL may also refer to an email address e.g. mailto:john@example.com.

Example

import streamlit as st

st.set_page_config(
    page_title="Ex-stream-ly Cool App",
    page_icon="🧊",
    layout="wide",
    initial_sidebar_state="expanded",
    menu_items={
        'Get Help': 'https://www.extremelycoolapp.com/help',
        'Report a bug': "https://www.extremelycoolapp.com/bug",
        'About': "# This is a header. This is an *extremely* cool app!"
    }
)
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.