Skip to content

st.multiselect (and st.selectbox) no longer supports repeated labels in options #11219

@sfc-gh-dmatthews

Description

@sfc-gh-dmatthews

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

With the introduction of accept_new_options, Streamlit uses the string value instead of the index internally to track selections. This means repeated labels aren't supported anymore

Reproducible Code Example

Open in Streamlit Cloud

import streamlit as st

class foo():
    def __init__(self, a):
        self.a = a
    def __repr__(self):
        return "foo " + self.a
    def __str__(self):
        return self.a

options = [foo("a"),"a"]

c = st.multiselect("C", options=options)
c

b = st.multiselect("D", options=["A", "B", "B", "C", "C", "C"])
b

Steps To Reproduce

  1. Run the app.
  2. Select either of the two items in the first multiselect. In both cases, the first instance is selected and no further selection can be made.
  3. Select "B" from the second multiselect and see that the second "B" can't be selected.
  4. Select "C" from the second multiselect and see that the other "C" items can't be selected.

Expected Behavior

Before the introduction of accept_new_options these multiple items could be selected.

Current Behavior

No response

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.44.2.dev20250424
  • Python version: 3.13
  • Operating System: Mac
  • Browser: Prisma

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.multiselectRelated to the `st.multiselect` widgetpriority:P3Medium prioritystatus:confirmedBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions