primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Dropdown: clear icon and value not shown when options are empty

Open riccardinhocala opened this issue 4 months ago • 0 comments

Describe the bug

When using the Dropdown component with showClear={true}, the clear icon does not appear if options is empty, even though the dropdown has a value.

Additionally, if options is empty, the value itself is not displayed — even when a custom valueTemplate is provided to explicitly render it.

This creates issues in scenarios where options are loaded asynchronously or only available at certain times (e.g., after a button click or API call). In these cases, I would still like to show the currently selected value and show the clear icon if value is set and showClear={true}

Reproducer

https://stackblitz.com/edit/zavs11yi

System Information

primereact: latest
react: 18.3.1

Steps to reproduce the behavior

  1. Render a Dropdown with a non-empty value and showClear={true}.
  2. Pass an empty array to options.
  3. Observe that both the value and the clear icon are missing.

Expected behavior

No response

riccardinhocala avatar Sep 05 '25 08:09 riccardinhocala