New Component: Streamlit Navigation Bar

Hi @ferdy, thanks for the suggestion!

My intention was to create a space between the body of the app and the top of the window of 6rem. Because this is the default value used by Streamlit. But thanks to your comment, I noticed that the space from st_navbar was actually 7rem. So I released version 3.1.1 that fixes this and reduces to 6rem. Now this is the output:

And this is Streamlit’s default space (for comparison):

I also added a new feature to the component. It is an option that can be passed in the options parameter:

options = {
    "use_padding": True
}

When "use_padding" is set to True, which is the default, it will position the body at 6rem from the top (if the navbar has a default height). But when set to False, it will remove the space and place the body right below the navbar.

For those who want to use more or less space, I recommend combining this option with putting one or more st.write("") before the content of the body. Each write command with an empty string will add 1rem of space.

4 Likes