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. Executing JavaScript is not supported at this time.
Function signature[source] | |
---|---|
st.html(body) | |
Parameters | |
body (any) | The HTML code to insert. This can be one of the following:
|
Example
import streamlit as st st.html( "<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>" )
Still have questions?
Our forums are full of helpful information and Streamlit experts.