Hi, I am currently developing a chatbot app with Streamlit. I want to add user authentication function to my app.
As most apps layout, I want to put my user status/login&logout button at top right corner of the page. But currently, this position is occupied by Streamlit’s deploy button.
I searched for solutions on the forum. There are some methods to hide the deploy bar like setting toolbarMode = “minimal” in config.toml. But the top space is still occupied and I cannot put the login/logout button to the top right corner.
This should hide the actual running man icon that appears when you’re loading a page.
I’m seeing another foum post where this guy is proposing a css hack to remove the actual space if you’re looking to go that far Remove UI Top Bar/Forehead
I tried your approach and get the following warning in the terminal (when ran locally), so I’m guessing its not/no longer supported, but I can confirm it does work
“ui.hidetopbar” is not a valid config option. If you previously had this config option set, it may have been removed.
You could try to overlay the default header with your own custom container.
Check the st_yled studio app for an example.
For this I added a simple container with key in my main.py/app.py
(I use the st_yled package but your can just exchange with regular Streamlit element (st.container)
sticky_header = st_yled.container(
key="sticky-header",
horizontal=True,
vertical_alignment="center",
)
with sticky_header:
st_yled.button("Export to your app", ....)
Then use the following css to set the container to foreground, with absolute position 0
I think I see your issue:
You may need to increase the z-index for the header. In my case I disabled the stAppToolbar (the header that contains the small Streamlit menu). The stAppToolbar has a z-index of 999990, so you need to set a z-index higher than that for the sticky header, otherwise the Toolbar will overlay the header.
I tried to reproduce your issue and changed the z-index, which resolved the problem in my case.
(BTW it is recommended to run st_yled.init() on each app page, otherwise st_yled components where no explicit key is specified won’t work)