feat: hide Streamlit chrome for app-like appearance
Add shared hide_streamlit_chrome() helper that removes header bar, hamburger menu, footer, and deploy button via CSS injection. Called on every page. Add .streamlit/config.toml with minimal toolbar mode. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Reusable Streamlit widgets for the deduplicator GUI."""
|
||||
"""Reusable Streamlit widgets for the DataTools GUI."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -24,6 +24,45 @@ from src.core.config import (
|
||||
from src.core.normalizers import NormalizerType
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# App chrome — hide Streamlit default UI for app-like feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
_HIDE_CHROME_CSS = """
|
||||
<style>
|
||||
/* Hide Streamlit header bar */
|
||||
header[data-testid="stHeader"] {
|
||||
display: none !important;
|
||||
}
|
||||
/* Hide hamburger menu */
|
||||
button[kind="header"] {
|
||||
display: none !important;
|
||||
}
|
||||
#MainMenu {
|
||||
display: none !important;
|
||||
}
|
||||
/* Hide footer */
|
||||
footer {
|
||||
display: none !important;
|
||||
}
|
||||
/* Hide deploy button */
|
||||
[data-testid="stAppDeployButton"] {
|
||||
display: none !important;
|
||||
}
|
||||
/* Reclaim top padding lost from hidden header */
|
||||
.stAppViewBlockContainer,
|
||||
[data-testid="stAppViewBlockContainer"] {
|
||||
padding-top: 1rem !important;
|
||||
}
|
||||
</style>
|
||||
"""
|
||||
|
||||
|
||||
def hide_streamlit_chrome() -> None:
|
||||
"""Inject CSS to hide Streamlit's default header, menu, and footer."""
|
||||
st.markdown(_HIDE_CHROME_CSS, unsafe_allow_html=True)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Config panel (advanced options)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user