I am new to Streamlit. I want to make a multiple-choice user input (checkboxes). But I want to select a maximum of 3 options out of 4 options.
I have tried with the dropdown feature of multiselect
.
import streamlit as st
option = st.multiselect('Select three known variables:', ['initial velocity (u)', 'final velocity (v)', 'acceleration (a)', 'time (t)'])
It works. But I think it won't be user-friendly for my case. Also, here I couldn't limit the selections to 3 out of 4. The user can select all 4 options here. But I want the code such that if the 4th one is selected, the previous selection (3rd option) will be automatically un-selected. I prefer the looks of the checkboxes such as the radio
buttons:
import streamlit as st
option = st.radio('Select three known variables:', ['initial velocity (u)', 'final velocity (v)', 'acceleration (a)', 'time (t)'])
But using radio
, I can't select multiple options. How can I edit it such that I can display it as checkboxes and only 3 options can be selected?