Thanks to visit codestin.com
Credit goes to github.com

Skip to content

st.multiselect ignores placeholder parameter when options are empty #11609

@Kulda22

Description

@Kulda22

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

The st.multiselect ignores placeholder parameter when options is an empty list ( or empty sequence in general) . This is even more prominent when using accept_new_options=True, as the input is not disabled then.

Reproducible Code Example

import streamlit as st

foo = st.multiselect(
    "Select Foo",
    options=[],
    accept_new_options=True,
    placeholder="foo placeholder",
)


bar = st.multiselect( # works correctly
    "Select Bar",
    options=["bar1", "bar2", "bar3"],
    accept_new_options=True,
    placeholder="bar placeholder",
)

Steps To Reproduce

  1. Run the example provided
  2. Compare the rendered placeholder with passed parameters

Expected Behavior

The Select Foo input placeholder should be foo placeholder not Add options.

Current Behavior

The first multiselect has the default placeholder.
Image

Is this a regression?

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

Debug info

  • Streamlit version: 1.45.1
  • Python version: 3.13.2
  • Operating System: MacOs 15.5
  • Browser: Firefox 139.0.4, Chrome 137.0.7151.104

Additional Information

No response

Metadata

Metadata

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