Streamlit-option-menu is a simple Streamlit component that allows users to select a single item from a list of options in a menu

Suddenly the streamlit-option-menu was not shown anymore in one of my apps on github/streamlit when using iPhone and Mac with Safari and Chrome. The solution in my case was to set streamlit==1.28.1 in requirements file. Just in case somebody else is running in to this mysterios phenomen:-)

You can report that to the author at streamlit-option-menu by filing an issue.

Stay away from third party libraries as much as possible as streamlit is rapidly advancing. Most of them could not level up.

At this time, streamlit’s menu capability is not bad at all and more are coming see the roadmap.

Hello, I was trying to round the corners using the “styles” option in the option-menu widget, but it does not work. Any ideas?

Here is the code:

if st.session_state:  
    st.sidebar.image(
        "./images/sidebar.png",
        use_column_width=True,
    )
    with st.sidebar:
        menu = option_menu(
            menu_title=None,
            options=[
                "Business",
                "Model",
                "Optimization",
                "Media Simulator",
                "Business Forecast",
                "Test Bench",
            ],
            icons=[
                "briefcase",
                "cpu",
                "bar-chart",
                "sliders",
                "graph-up-arrow",
                "gear",
            ],
            default_index=0,
            orientation="vertical",
        )
        styles={
        "container": {"padding": "0!important", "background-color": "#444444", "border-radius": "15px"},
    }

Your component is awesome!

May it be possible to add a some functionality regarding the menu: if an parent item (i.e. an item having children) is clicked, the page reloads.

But as the click only opens/closes the group it would be great to avoid this reload.

@victoryhb

As others have said this package is great. I am using this for some projects that I am involved with, but cannot use it for all of them.

This is because the license is not listed in the PYPI.org listing and also makes pip-licenses return an UNKNOWN license type when generating a license report. The provider I am working with requires that licenses are not tagged as UNKNOWN for python packages we work with.

Would it be possible to update the package so the MIT license is correctly registered with PYPI.org?

If only I could make streamlit_option_menu work inside of Snowflake. Even cut/paste from examples fail. I am now experimenting with other navigation methods such as multiple pages but that presents it’s own issues. Streamlit within Snowflake - especially the st…_option_menu module - appears kludgy and not ready for prime time.

Can we use the custom icons from local or Material icons from Google fonts?

hello, how i can put menu uses the full width

Hello!!

Can someone help me?

I’m working on a Streamlit application that uses the streamlit_option_menu for navigation within the sidebar. The current implementation successfully displays the menu with options for “Sales” and “Contacts”. However, I would like to enhance the functionality so that selecting an option directs the user to a separate page (e.g., pages/Sales.py and pages/Contacts.py), while still keeping the option_menu visible and functional in the sidebar across all pages.

Here’s the script that currently works for displaying the sidebar menu and handling selections:

> import streamlit as st
> from streamlit_option_menu import option_menu
> 
> st.set_page_config(layout="wide", initial_sidebar_state="auto")
> 
> if st.session_state.get('logged_in'):
>     with st.sidebar:
>         selected = option_menu(
>             'Menu',
>             ['Sales', 'Contacts'],
>             icons=['house', 'door-open'],
>             default_index=0
>         )
> 
> if selected == 'Sales':
>     script to go pages/Sales.py
> 
> elif selected == 'Contacts':
>      script to go pages/Contacts.py

my_streamlit_app/
├── app.py
├── pages/
│ ├── Sales.py
│ └── Contacts.py