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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/victoryhb/streamlit-option-menu",
"name": "streamlit-option-menu-patched",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Victor Yan",
"author_email": "victoryhb@163.com",
"download_url": "https://files.pythonhosted.org/packages/16/3e/757e9b998191c994a87ac70891510bc35617477cbe303906e1903e3e0ae9/streamlit_option_menu_patched-0.3.12.tar.gz",
"platform": null,
"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.\nIt is similar in function to st.selectbox(), except that:\n- It uses a simple static list to display the options instead of a dropdown\n- It has configurable icons for each option item and the menu title\n\nIt 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/)\n\n## Installation\n```\npip install streamlit-option-menu\n```\n\n## Parameters\nThe `option_menu` function accepts the following parameters:\n- menu_title (required): the title of the menu; pass None to hide the title\n- options (required): list of (string) options to display in the menu; set an option to \"---\" if you want to insert a section separator\n- default_index (optional, default=0): the index of the selected option by default\n- menu_icon (optional, default=\"menu-up\"): name of the [bootstrap-icon](https://icons.getbootstrap.com/) to be used for the menu title\n- 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\n- orientation (optional, default=\"vertical\"): \"vertical\" or \"horizontal\"; whether to display the menu vertically or horizontally\n\nThe function returns the (string) option currently selected\n\n## Example\n```\nimport streamlit as st\nfrom streamlit_option_menu import option_menu\n\nwith st.sidebar:\n selected = option_menu(\"Main Menu\", [\"Home\", 'Settings'], \n icons=['house', 'gear'], menu_icon=\"cast\", default_index=1)\n selected\n\n# horizontal Menu\nselected2 = option_menu(None, [\"Home\", \"Upload\", \"Tasks\", 'Settings'], \n icons=['house', 'cloud-upload', \"list-task\", 'gear'], \n menu_icon=\"cast\", default_index=0, orientation=\"horizontal\")\n selected2\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "streamlit-option-menu is a simple Streamlit component that allows users to select a single item from a list of options in a menu.",
"version": "0.3.12",
"project_urls": {
"Homepage": "https://github.com/victoryhb/streamlit-option-menu"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "76e78b541fb20372bbb6e57ebf849af3156c2a71410b7f6eeb6e9021d74f927b",
"md5": "1d4d8e9e0ce891547be618a928d57584",
"sha256": "560c3a56385b00a39049d1f16157206e8f4785dcbd6ed30e03f6b1351d99f8f8"
},
"downloads": -1,
"filename": "streamlit_option_menu_patched-0.3.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1d4d8e9e0ce891547be618a928d57584",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5734,
"upload_time": "2024-05-23T11:37:38",
"upload_time_iso_8601": "2024-05-23T11:37:38.538276Z",
"url": "https://files.pythonhosted.org/packages/76/e7/8b541fb20372bbb6e57ebf849af3156c2a71410b7f6eeb6e9021d74f927b/streamlit_option_menu_patched-0.3.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "163e757e9b998191c994a87ac70891510bc35617477cbe303906e1903e3e0ae9",
"md5": "f9b1a90d3827841d1d5275952d93fd25",
"sha256": "8734393f0f1c5a093ce450854516158d819029ef5c15c1573441aa1bd2d38288"
},
"downloads": -1,
"filename": "streamlit_option_menu_patched-0.3.12.tar.gz",
"has_sig": false,
"md5_digest": "f9b1a90d3827841d1d5275952d93fd25",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5934,
"upload_time": "2024-05-23T11:37:39",
"upload_time_iso_8601": "2024-05-23T11:37:39.769043Z",
"url": "https://files.pythonhosted.org/packages/16/3e/757e9b998191c994a87ac70891510bc35617477cbe303906e1903e3e0ae9/streamlit_option_menu_patched-0.3.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-23 11:37:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "victoryhb",
"github_project": "streamlit-option-menu",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "streamlit-option-menu-patched"
}