From c7398247d6bb3fb8b1a4a5e5b13548c45bb4cd2d Mon Sep 17 00:00:00 2001 From: Luke Hoggatt Date: Wed, 13 Sep 2023 11:11:59 -0500 Subject: [PATCH] allow setting default options --- st_combobox/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/st_combobox/__init__.py b/st_combobox/__init__.py index c94f533..bfa9219 100644 --- a/st_combobox/__init__.py +++ b/st_combobox/__init__.py @@ -87,6 +87,7 @@ def st_combobox( clear_on_submit: bool = False, key: str = "combobox", rerun_on_update: bool = True, + default_options = [], **kwargs, ) -> any: """ @@ -108,6 +109,8 @@ def st_combobox( Streamlit session key. Defaults to "combobox". rerun_on_update (bool, optional): Rerun the search function on each keystroke. Defaults to True. + default_options (List[any], optional): + List of options to be displayed by default. Defaults to None. Returns: any: based on user selection @@ -123,7 +126,7 @@ def st_combobox( # updated after each search keystroke "search": "", # updated after each search_function run - "options": [], + "options": default_options, } # everything here is passed to react as this.props.args