Display text in header formatting.

Function signature[source]

st.header(body, anchor=None, *, help=None, divider=False)


body (str)

The text to display as Github-flavored Markdown. Syntax information can be found at: https://github.github.com/gfm.

This also supports:

  • Emoji shortcodes, such as :+1: and :sunglasses:. For a list of all supported codes, see https://share.streamlit.io/streamlit/emoji-shortcodes.
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$" must be on their own lines). Supported LaTeX functions are listed at https://katex.org/docs/supported.html.
  • Colored text, using the syntax :color[text to be colored], where color needs to be replaced with any of the following supported colors: blue, green, orange, red, violet, gray/grey, rainbow.

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)

An optional tooltip that gets displayed next to the header.

divider (bool or “blue”, “green”, “orange”, “red”, “violet”, “gray”/"grey", or “rainbow”)

Shows a colored divider below the header. If True, successive headers will cycle through divider colors. That is, the first header will have a blue line, the second header will have a green line, and so on. If a string, the color can be set to one of the following: blue, green, orange, red, violet, gray/grey, or rainbow.


import streamlit as st

st.header('This is a header with a divider', divider='rainbow')
st.header('_Streamlit_ is :blue[cool] :sunglasses:')

Still have questions?

Our forums are full of helpful information and Streamlit experts.

Was this page helpful?

editEdit this page on GitHub