st.title
Display text in title formatting.
Each document should have a single st.title(), although this is not enforced.
| Function signature[source] | |
|---|---|
st.title(body, anchor=None, *, help=None, icon=None, width="stretch", text_alignment="left", wrap=True) | |
| Parameters | |
body (str) | The text to display as GitHub-flavored Markdown. Syntax information can be found at: https://github.github.com/gfm. See the body parameter of st.markdown for additional, supported Markdown directives. |
anchor (str or False) | The anchor name of the header that can be accessed with #anchor in the URL. If omitted, it generates an anchor using the body. If False, the anchor is not shown in the UI. |
help (str or None) | A tooltip that gets displayed next to the title. If this is None (default), no tooltip is displayed. The tooltip can optionally contain GitHub-flavored Markdown, including the Markdown directives described in the body parameter of st.markdown. |
icon (str or None) | An optional emoji or icon to display next to the title. If icon is None (default) or "", no icon is displayed. Empty string is accepted so you can pass page.icon when a page has no icon. If icon is a non-empty string, the following options are valid:
The icon is decorative: it is not included in the heading's accessible name and does not affect the auto-generated anchor. |
width ("stretch", "content", or int) | The width of the title element. This can be one of the following:
|
text_alignment ("left", "center", "right", or "justify") | The horizontal alignment of the text within the element. This can be one of the following:
Note For text alignment to have a visible effect, the element's width must be wider than its content. If you use width="content" with short text, the alignment may not be noticeable. |
wrap (bool) | Whether the title can wrap onto multiple lines. This can be one of the following:
|
Examples
import streamlit as st st.title("This is a title") st.title("_Streamlit_ is :blue[cool] :sunglasses:") st.title("Dashboard", icon=":material/dashboard:")
Tip
Want a new st.title feature or found a bug? Browse open issues and react with a 👍 on the initial post of the ones that matter to you. Your votes help us prioritize what to work on next.
Still have questions?
Our forums are full of helpful information and Streamlit experts.