Hello there 👋

Thanks for stopping by! We use cookies to help us understand how you interact with our website.

By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.

priority_high

Warning

You are reading the documentation for Streamlit version 1.22.0, but 1.45.0 is the latest version available.

Display warning message.

Function signature[source]

st.warning(body, *, icon=None)

Parameters

body (str)

The warning text to display.

icon (str or None)

An optional, keyword-only argument that specifies an emoji to use as the icon for the alert. Shortcodes are not allowed, please use a single character instead. E.g. "🚨", "🔥", "🤖", etc. Defaults to None, which means no icon is displayed.

Example

import streamlit as st

st.warning('This is a warning', icon="⚠️")
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.