Choices
Choices copied to clipboard
Allow deselect when renderSelectedChoices enabled
Description
Drafting this PR as I am not sure if you would want to follow a different approach. If this looks good I can try to add tests.
There have been a few requests to allow for deselecting items via the dropdown when the renderSelectedChoices
option is enabled. #804 #884
I ran across this issue myself while needing to keep a multiselect box footprint minimal (it grows to be pretty large when selecting a few options).
This PR has 3 parts:m
- highlight selected choices in the dropdown when
renderSelectedChoices
is enabled - allow clicking on a selected choice in the dropdown to deselect the choice
- add a new
renderItems
boolean option to disable the "pills" in the multiselect input to allow one to only select/deselect via the dropdown
Screenshots (if appropriate)
Example of having both renderSelectedChoices: 'always'
and renderItems: false
Types of changes
- [x] Chore (tooling change or documentation change)
- [ ] Refactor (non-breaking change which maintains existing functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist
- [x] My code follows the code style of this project.
- [ ] I have added new tests for the bug I fixed/the new feature I added.
- [ ] I have modified existing tests for the bug I fixed/the new feature I added.
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.