streamlit-option-menu is a simple Streamlit component that allows users to select a single item from a list of options in a menu.
streamlit-option-menu is a simple Streamlit component that allows users to select a single item from a list of options in a menu. It is similar in function to st.selectbox(), except that:
It is built on streamlit-component-template-vue, styled with Bootstrap and with icons from bootstrap-icons
pip install streamlit-option-menu
The option_menu
function accepts the following parameters:
The function returns the (string) option currently selected
import streamlit as st
from streamlit_option_menu import option_menu
with st.sidebar:
selected = option_menu("Main Menu", ["Home", 'Settings'],
icons=['house', 'gear'], menu_icon="cast", default_index=1)
selected
# horizontal Menu
selected2 = option_menu(None, ["Home", "Upload", "Tasks", 'Settings'],
icons=['house', 'cloud-upload', "list-task", 'gear'],
menu_icon="cast", default_index=0, orientation="horizontal")
selected2