So I decided to create my own custom navigation bar with CSS. But needed a custom navigation component (navigation tabs). Took a while, but I finally got there. More work needs to be done but its my first time using typescript so please bare with me.
Firstly, you’d need to download the style.css file into your directory and load it as in the example in the github page above (see readme). Then import the component and you are good to go. I recently updated streamlit and noticed a change in the css, just one, that was related to the navigation bar (the stHeader) but have added this to the style css file. This is the main problem, as streamlit updates, changes to the navigation bar are to be expected but they can be easily adjusted with CSS.
Anyway, thanks streamlit, and enjoy everyone!
UPDATE
I have now implemented custom CSS to adjust tabs for your own custom navigation. I borrowed the CSS implementation from the wonderful Victoryhb’s option menu.
So… make your own nav bar using the CSS file (style) and build your own tabs to accommodate it.
This feature doesn’t work for me… I used an image background in my app, it might be the reason.
The navtab works well but the rest of the app does not move with it, and leave a blank column which is not good.
Hey, so sorry for the late response. I have looked into it and its an issue with streamlit’s sidebar css. It has a set min-width and a width of 335px I think. Removing those should make the package function as normal. Though I am having a bit of trouble making these changes in a css file. Will get back to you when I have figured this out.
section[data-testid='stSidebar']{
background-color: #111;
min-width:unset !important;
max-width: unset !important; /*<--- This part is optional.*/
width: unset !important;
flex-shrink: unset !important; /*<--- This part is optional.*/
}
`