st.components.v1.html - Streamlit Docs
Show API reference for
delete

Deprecation notice

st.components.v1.html was deprecated in version 1.56.0 and will be removed in a later version. Use st.iframe instead. To insert HTML into your app without an iframe, use st.html.

Display an HTML string in an iframe.

To use this function, import it from the streamlit.components.v1 module.

If you want to insert HTML text into your app without an iframe, try st.html instead.

Warning

The HTML string is embedded as-is in an iframe that allows JavaScript execution and same-origin access to the Streamlit app. Never pass untrusted HTML from users, query parameters, databases, uploaded files, LLM output, or other external sources to this function. Use st.html for sanitized HTML snippets that don't need full iframe behavior.

Examples

import streamlit.components.v1 as components

components.html(
    "<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>"
)
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.