st.html - Streamlit Docs
Show API reference for

Insert HTML into your app.

Adding custom HTML to your app impacts safety, styling, and maintainability. We sanitize HTML with DOMPurify, but inserting HTML remains a developer risk. Passing untrusted code to st.html or dynamically loading external code can increase the risk of vulnerabilities in your app.

st.html content is not iframed. By default, JavaScript is ignored. To execute JavaScript contained in your HTML, set unsafe_allow_javascript=True. Use this with caution and never pass untrusted input.

Examples

import streamlit as st

st.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.