Renders a logo in the upper-left corner of your app and its sidebar.

If st.logo is called multiple times within a page, Streamlit will render the image passed in the last call. For the most consistent results, call st.logo early in your page script and choose an image that works well in both light and dark mode. Avoid empty margins around your image.

If your logo does not work well for both light and dark mode, consider setting the theme and hiding the settings menu from users with the configuration option client.toolbarMode="minimal".

Function signature[source]

st.logo(image, *, link=None, icon_image=None)

Parameters

image (Anything supported by st.image)

The image to display in the upper-left corner of your app and its sidebar. If icon_image is also provided, then Streamlit will only display image in the sidebar.

Streamlit scales the image to a height of 24 pixels and a maximum width of 240 pixels. Use images with an aspect ratio of 10:1 or less to avoid distortion.

link (str or None)

The external URL to open when a user clicks on the logo. The URL must start with "http://" or "https://". If link is None (default), the logo will not include a hyperlink.

icon_image (Anything supported by st.image or None)

An alternate image to replace image in the upper-left corner of the app's main body. If icon_image is None (default), Streamlit will render image in the upper-left corner of the app and its sidebar. Otherwise, Streamlit will render icon_image in the upper-left corner of the app and image in the upper-left corner of the sidebar.

Streamlit scales the image to a height of 24 pixels and a maximum width of 240 pixels. Use images with an aspect ratio of 10:1 or less to avoid distortion.

Examples

A common design practice is to use a wider logo in the sidebar, and a smaller, icon-styled logo in your app's main body.

import streamlit as st

st.logo(
    LOGO_URL_LARGE,
    link="https://streamlit.io/gallery",
    icon_image=LOGO_URL_SMALL,
)

Try switching logos around in the following example:

import streamlit as st

HORIZONTAL_RED = "images/horizontal_red.png"
ICON_RED = "images/icon_red.png"
HORIZONTAL_BLUE = "images/horizontal_blue.png"
ICON_BLUE = "images/icon_blue.png"

options = [HORIZONTAL_RED, ICON_RED, HORIZONTAL_BLUE, ICON_BLUE]
sidebar_logo = st.selectbox("Sidebar logo", options, 0)
main_body_logo = st.selectbox("Main body logo", options, 1)

st.logo(sidebar_logo, icon_image=main_body_logo)
st.sidebar.markdown("Hi!")
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.