| Function signature[source] | |
|---|---|
st.success(body, *, icon=None, width="stretch", title=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. If icon is None, and body begins with an emoji or Material icon shortcode, Streamlit will extract it and display it slightly enlarged, as if it were passed to icon. If body contains multiple icons, or you want to override this behavior, you can insert a null Markdown directive like :red[] before your leading icon. |
icon (str or None) | An optional emoji or icon to display next to the alert. If icon is None (default), Streamlit attempts to extract a leading emoji or Material icon shortcode from body. If found, the icon is displayed and removed from the body text. If no leading icon is found, no icon is displayed. If icon is a string, it takes precedence over any icon in the body, and the following options are valid:
|
width ("stretch" or int) | The width of the success element. This can be one of the following:
|
title (str or None) | An optional title to display above the body text. If None (default), no title is displayed. The title is rendered with bold styling and can optionally contain GitHub-flavored Markdown of the following types: Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display elements are not supported. See the body parameter of |st.markdown|_ for additional, supported Markdown directives. |
Examples
import streamlit as st
st.success('This is a success message!', icon="✅")
Still have questions?
Our forums are full of helpful information and Streamlit experts.