Closed samsucik closed 8 months ago
Typically the values displayed are driven by the search_function
that is passed to the component. If you want to run it without the search function you can also set the options
manually, (the search
state is handled via react), See the example below:
key = f"{search.__name__}_manual"
n_options = st.slider("slider", 0, 10, 5, key="slider")
if key in st.session_state:
st.session_state[key]["options_js"] = [
{"label": f"{st.session_state[key]['search']}_{i}", "value": i}
for i in range(n_options)
]
st.session_state[key]["options_py"] = [i for i in range(n_options)]
manual = st_searchbox(
search_function=lambda _: [],
key=key,
)
st.write(manual)
I'm struggling to make changes to the value displayed in the searchbox. Does anyone have any advice?
What I've tried so far:
st.session_state.<searchbox_key>["result"]
__init__.py
(roughly here)While the entry in
st.session_state
changes, the searchbox continues do display just the default placeholder (Search ...
).Fyi I'm using the 0.1.3 version installed from PyPi