Skip to content

feat: add emptyText to SelectArrayInput - #11378

Open
SurendraKumawat7742 wants to merge 1 commit into
marmelab:masterfrom
SurendraKumawat7742:fix-selectarrayinput-emptytext
Open

SurendraKumawat7742 wants to merge 1 commit into
marmelab:masterfrom
SurendraKumawat7742:fix-selectarrayinput-emptytext

Conversation

@SurendraKumawat7742

Copy link
Copy Markdown

Problem

SelectArrayInput does not currently support the emptyText prop, so users cannot provide an empty option in the dropdown to clear all selected values.

Solution

  • Add support for the emptyText prop to SelectArrayInput.
  • Render emptyText as an empty option in the dropdown.
  • Translate string values consistently with other choice inputs.
  • Clear the selected values by calling onChange([]) when the empty option is selected.
  • Add a unit test covering the new behavior.

How To Test

  • Run : npx jest packages/ra-ui-materialui/src/input/SelectArrayInput.spec.tsx --runInBand
  • Expected result : Test Suites: 1 passed, 1 total , Tests: 37 passed, 37 total

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

Also, please make sure to read the contributing guidelines.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant