A radio button lets a user choose exactly one value from a list. In Streamlit, st.radio displays the choices and stores the selected option in a Python variable. section 3.6.1
Choose a quantity
quantity = st.radio("Select a quantity", ["Mass", "Length", "Time"]) This displays three choices. After selection, quantity contains the chosen string, such as "Mass". The options can begin as a hardcoded list and later come from a backend. section 3.6.1
Use radio buttons when the interface needs one choice from a visible set:
- Place the control in the sidebar with st.sidebar.radio(...) when it belongs in a left-side panel. section 3.6.1
- Use the selected value to drive later controls; the unit converter updates its From and To menus after a quantity is chosen. section 3.5.3
- Customize the presentation by arranging options horizontally, adding captions, or disabling them when appropriate. section 3.6.1
quantity = st.radio("Select a quantity", ["Mass", "Length", "Time"])
Inspect the minimal st.radio call that creates the quantity selector and returns the selected option. section 3.6.1



