a selectbox with a default value
To upload files, please first save the app
"""
setting a default value for a selectbox
"""
import streamlit as st
options = ["Apple", "Banana", "Cherry", "Date", "Fig", "Grape", "Pear"]
default_index = options.index("Apple")
# works in a sidebar...
st.sidebar.selectbox('Pick a fruit', options, index=default_index)
# and a standalone selectbox
st.selectbox('Pick a fruit', options, index=default_index, key='select-box')
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?