Skip to main content

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

Project description

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 uses a simple static list to display the options instead of a dropdown
- It has configurable icons for each option item and the menu title

It is built on [streamlit-component-template-vue](https://github.com/andfanilo/streamlit-component-template-vue), styled with [Bootstrap](https://getbootstrap.com/) and with icons from [bootstrap-icons](https://icons.getbootstrap.com/)

## Installation
```
pip install streamlit-option-menu
```

## Parameters
The `option_menu` function accepts the following parameters:
- menu_title (required): the title of the menu; pass None to hide the title
- options (required): list of (string) options to display in the menu; set an option to "---" if you want to insert a section separator
- default_index (optional, default=0): the index of the selected option by default
- menu_icon (optional, default="menu-up"): name of the [bootstrap-icon](https://icons.getbootstrap.com/) to be used for the menu title
- icons (optional, default=["caret-right"]): list of [bootstrap-icon](https://icons.getbootstrap.com/) names to be used for each option; its length should be equal to the length of options
- orientation (optional, default="vertical"): "vertical" or "horizontal"; whether to display the menu vertically or horizontally

The function returns the (string) option currently selected

## Example
```
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
```


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit-option-menu-0.3.2.tar.gz (709.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_option_menu-0.3.2-py3-none-any.whl (712.3 kB view details)

Uploaded Python 3

File details

Details for the file streamlit-option-menu-0.3.2.tar.gz.

File metadata

  • Download URL: streamlit-option-menu-0.3.2.tar.gz
  • Upload date:
  • Size: 709.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.3

File hashes

Hashes for streamlit-option-menu-0.3.2.tar.gz
Algorithm Hash digest
SHA256 69d1aef6f30f83f29eda3dc9667733bc2e28cd640eb17b4b6ca315f633484c52
MD5 0b3fc641ecfcbe30a04a22cc8d095da1
BLAKE2b-256 b4ece66eb5baaf6436854b717ef9b449918c9c1d7f6dd358243784f4c494dfb5

See more details on using hashes here.

File details

Details for the file streamlit_option_menu-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: streamlit_option_menu-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 712.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.3

File hashes

Hashes for streamlit_option_menu-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0b7eae3ffdb0276c81d15750465c72957d57d2f766cb027c586d053519731178
MD5 5799c4e0754a02ed416de742bceefe40
BLAKE2b-256 ab995176a8e9a8dee578c43c3cae6d4875d4d644f4c3403bbc7c070cdc03f7d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page