Display text in small font.

This should be used for captions, asides, footnotes, sidenotes, and other explanatory text.

Function signature[source]

st.caption(body, unsafe_allow_html=False, *, help=None)

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.

unsafe_allow_html (bool)

Whether to render HTML within body. If this is False (default), any HTML tags found in body will be escaped and therefore treated as raw text. If this is True, any HTML expressions within body will be rendered.

Adding custom HTML to your app impacts safety, styling, and maintainability.

Note

If you only want to insert HTML or CSS without Markdown text, we recommend using st.html instead.

help (str)

An optional tooltip that gets displayed next to the caption.

Examples

import streamlit as st

st.caption("This is a string that explains something above.")
st.caption("A caption with _italics_ :blue[colors] and emojis :sunglasses:")
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.