Context
Streamlit has deprecated st.components.v1.html with a removal deadline of 2026-06-01:
st.components.v1.html will be removed after 2026-06-01.
Please replace st.components.v1.html with st.iframe.
Impact
13 core library files use components.html() with ~18 direct calls:
| File |
Calls |
Pattern |
book.py |
5 |
Search script injection |
loading.py |
3 |
Loading overlay (height=0) |
bib_preview.py |
1 |
Hover card JS (height=0) |
marker.py |
1 |
Floating nav widget (height=0) |
auth.py |
1 |
Keyboard listener (height=0) |
mermaid.py |
1 |
Diagram pan/zoom (height=N, scrolling) |
plantuml.py |
1 |
Diagram pan/zoom (height=N, scrolling) |
tikz.py |
1 |
Diagram pan/zoom (height=N, scrolling) |
latex.py |
1 |
LaTeX rendering (height=N, scrolling) |
browser.py |
1 |
Chrome banner (height=0) |
export.py |
1 |
Dual-render pipeline |
Note: Files using st.html() for CSS injection (grid, list, zoom, container, etc.) are not affected.
Risk assessment — HIGH (8/10)
- Deadline: ~2 months away
- All StreamTeX apps break after 2026-06-01 if not migrated
- Users cannot workaround — calls are in library code
- Two critical patterns to validate:
- Zero-height iframes (
height=0) for JS injection via parent.document
scrolling parameter — not documented in st.iframe() API
New API: st.iframe()
st.iframe(
src: str | Path,
*,
width: int | Literal["stretch", "content"] = "stretch",
height: int | Literal["stretch", "content"] = "content",
tab_index: int | None = None,
)
Key differences:
- Auto-detects input type (URL, Path, HTML string)
- New sizing modes:
"stretch", "content"
- No explicit
scrolling parameter (needs investigation)
Proposed solution
Create a centralized wrapper streamtex/_iframe.py:
def stx_iframe(html: str, *, height: int = 0, scrolling: bool = False):
"""Unified iframe injection — auto-selects API by Streamlit version."""
if _USE_NEW_IFRAME:
st.iframe(html, height=height)
else:
import streamlit.components.v1 as components
components.html(html, height=height, scrolling=scrolling)
Then replace all components.html() calls across 13 files with stx_iframe().
Validation checklist
Deadline
Must be completed before 2026-05-15 (2 weeks buffer before removal date).
📅 Reminder: checkpoint on 2026-04-20 to verify progress.
Context
Streamlit has deprecated
st.components.v1.htmlwith a removal deadline of 2026-06-01:Impact
13 core library files use
components.html()with ~18 direct calls:book.pyloading.pybib_preview.pymarker.pyauth.pymermaid.pyplantuml.pytikz.pylatex.pybrowser.pyexport.pyNote: Files using
st.html()for CSS injection (grid, list, zoom, container, etc.) are not affected.Risk assessment — HIGH (8/10)
height=0) for JS injection viaparent.documentscrollingparameter — not documented inst.iframe()APINew API:
st.iframe()Key differences:
"stretch","content"scrollingparameter (needs investigation)Proposed solution
Create a centralized wrapper
streamtex/_iframe.py:Then replace all
components.html()calls across 13 files withstx_iframe().Validation checklist
st.iframe(html_string, height=0)works for JS injectionparent.documentaccess is preserved (iframe sandbox policy)st.iframe()_iframe.pywrapperpyproject.tomlif neededDeadline
Must be completed before 2026-05-15 (2 weeks buffer before removal date).
📅 Reminder: checkpoint on 2026-04-20 to verify progress.