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
- options (required): the array of (string) options to display in the menu
- 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"]): array of [bootstrap-icon](https://icons.getbootstrap.com/) names to be used for each option; its length should be equal to the length of options;
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
```
Project details
Release history Release notifications | RSS feed
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.2.2.tar.gz
(705.8 kB
view hashes)
Built Distribution
Close
Hashes for streamlit-option-menu-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c43391edd4f1e3932302c111cbfe0ed81a6b5f396df8efdfa72c92941b237ae9 |
|
MD5 | d2f4f6d43a67748dc92cbe009ce0a1ee |
|
BLAKE2b-256 | d274a5ad0813a311b6440b1507512afcaa24a3a346d493aa1148aabae2ecdd1b |
Close
Hashes for streamlit_option_menu-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa6c8f8c569cdfcb9b45312e1e5dd3520269cb7e0dc7f7157235f6c612783e2a |
|
MD5 | f87d5a6100611eebd7ccefd7c5789caa |
|
BLAKE2b-256 | 298c35f0553543de994ee6103b9e68a78a85bc7fc55f524c7a8bee2ff35061b6 |