79116074

Date: 2024-10-23 00:23:21
Score: 0.5
Natty:
Report link

st.multiselect now has a max_selections argument (I tested this in Streamlit 1.39.0). Here's a demo.

enter image description here

import streamlit as st

st.title("Multiple Choice Example")

options = st.multiselect(
    "Select your options (max 3)",
    options=["Option 1", "Option 2", "Option 3", "Option 4"],
    max_selections=3,
)

st.write("You selected:", options)
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: Eduardo