File size: 857 Bytes
efbe6b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import streamlit.components.v1 as components

_RELEASE = True

if not _RELEASE:
    _component_func = components.declare_component(
        "option_menu",
        url="http://localhost:3001",
    )
else:
    parent_dir = os.path.dirname(os.path.abspath(__file__))
    build_dir = os.path.join(parent_dir, "frontend/dist")
    _component_func = components.declare_component("option_menu", path=build_dir)


def option_menu(menu_title, options, default_index=0, orientation="vertical",
                menu_icon=None, icons=None, styles=None, key=None):
    component_value = _component_func(
        menuTitle=menu_title,
        options=options,
        defaultIndex=default_index, menuIcon=menu_icon,
        icons=icons, orientation=orientation,
        default=options[default_index],
        styles=styles, key=key)
    return component_value