├── README.md ├── requirements.txt └── streamlit_menu_demo.py /README.md: -------------------------------------------------------------------------------- 1 | # The EASIEST way to insert a NAVBAR into your Streamlit app 2 | 3 | In this video, I'm going to show you how to embed a navigation menu into your streamlit app. 4 | 5 | ## Tutorial 6 | [![YouTube Video](https://img.youtube.com/vi/hEPoto5xp3k/0.jpg)](https://youtu.be/hEPoto5xp3k) 7 | 8 | ## Further Links 9 | - streamlit-option-menu repo: https://github.com/victoryhb/streamlit-option-menu 10 | - Bootstrap Icons: https://icons.getbootstrap.com/ 11 | 12 | 13 | 14 | ## 🤓 Check Out My Excel Add-ins 15 | I've developed some handy Excel add-ins that you might find useful: 16 | 17 | - 📊 **[Dashboard Add-in](https://pythonandvba.com/grafly)**: Easily create interactive and visually appealing dashboards. 18 | - 🎨 **[Cartoon Charts Add-In](https://pythonandvba.com/cuteplots)**: Create engaging and fun cartoon-style charts. 19 | - 🤪 **[Emoji Add-in](https://pythonandvba.com/emojify)**: Add a touch of fun to your spreadsheets with emojis. 20 | - 🛠️ **[MyToolBelt Add-in](https://pythonandvba.com/mytoolbelt)**: A versatile toolbelt for Excel, featuring: 21 | - Creation of Pandas DataFrames and Jupyter Notebooks from Excel ranges 22 | - ChatGPT integration for advanced data analysis 23 | - And much more! 24 | 25 | 26 | 27 | ## 🤝 Connect with Me 28 | - 📺 **YouTube:** [CodingIsFun](https://youtube.com/c/CodingIsFun) 29 | - 🌐 **Website:** [PythonAndVBA](https://pythonandvba.com) 30 | - 💬 **Discord:** [Join the Community](https://pythonandvba.com/discord) 31 | - 💼 **LinkedIn:** [Sven Bosau](https://www.linkedin.com/in/sven-bosau/) 32 | - 📸 **Instagram:** [sven_bosau](https://www.instagram.com/sven_bosau/) 33 | 34 | ## ☕ Support 35 | If you appreciate the project and wish to encourage its continued development, consider [supporting my work](https://pythonandvba.com/coffee-donation). 36 | [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://pythonandvba.com/coffee-donation) 37 | 38 | ## Feedback & Collaboration 39 | For feedback, suggestions, or potential collaboration opportunities, reach out at contact@pythonandvba.com. 40 | ![Logo](https://www.pythonandvba.com/banner-img) 41 | 42 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | streamlit_option_menu==0.3.2 2 | streamlit==1.7.0 3 | -------------------------------------------------------------------------------- /streamlit_menu_demo.py: -------------------------------------------------------------------------------- 1 | import streamlit as st 2 | from streamlit_option_menu import option_menu 3 | 4 | # 1=sidebar menu, 2=horizontal menu, 3=horizontal menu w/ custom menu 5 | EXAMPLE_NO = 1 6 | 7 | 8 | def streamlit_menu(example=1): 9 | if example == 1: 10 | # 1. as sidebar menu 11 | with st.sidebar: 12 | selected = option_menu( 13 | menu_title="Main Menu", # required 14 | options=["Home", "Projects", "Contact"], # required 15 | icons=["house", "book", "envelope"], # optional 16 | menu_icon="cast", # optional 17 | default_index=0, # optional 18 | ) 19 | return selected 20 | 21 | if example == 2: 22 | # 2. horizontal menu w/o custom style 23 | selected = option_menu( 24 | menu_title=None, # required 25 | options=["Home", "Projects", "Contact"], # required 26 | icons=["house", "book", "envelope"], # optional 27 | menu_icon="cast", # optional 28 | default_index=0, # optional 29 | orientation="horizontal", 30 | ) 31 | return selected 32 | 33 | if example == 3: 34 | # 2. horizontal menu with custom style 35 | selected = option_menu( 36 | menu_title=None, # required 37 | options=["Home", "Projects", "Contact"], # required 38 | icons=["house", "book", "envelope"], # optional 39 | menu_icon="cast", # optional 40 | default_index=0, # optional 41 | orientation="horizontal", 42 | styles={ 43 | "container": {"padding": "0!important", "background-color": "#fafafa"}, 44 | "icon": {"color": "orange", "font-size": "25px"}, 45 | "nav-link": { 46 | "font-size": "25px", 47 | "text-align": "left", 48 | "margin": "0px", 49 | "--hover-color": "#eee", 50 | }, 51 | "nav-link-selected": {"background-color": "green"}, 52 | }, 53 | ) 54 | return selected 55 | 56 | 57 | selected = streamlit_menu(example=EXAMPLE_NO) 58 | 59 | if selected == "Home": 60 | st.title(f"You have selected {selected}") 61 | if selected == "Projects": 62 | st.title(f"You have selected {selected}") 63 | if selected == "Contact": 64 | st.title(f"You have selected {selected}") 65 | --------------------------------------------------------------------------------