Display text in header formatting.
Function signature

st.header(body, anchor=None)

Parameters

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.

anchor (str)

The anchor name of the header that can be accessed with #anchor in the URL. If omitted, it generates an anchor using the body.

Examples

import streamlit as st

st.header('This is a header')
st.header('A header with _italics_ :blue[colors] and emojis :sunglasses:')

Was this page helpful?

editSuggest edits
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.