Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow applying classes to the trigger items when in multi select #1460

Open
cah-brian-gantzler opened this issue Jun 27, 2021 · 0 comments
Open

Comments

@cah-brian-gantzler
Copy link
Contributor

cah-brian-gantzler commented Jun 27, 2021

When power select is in multi select mode, the item that is generated contains the clear in an <li> element. While there is a selectedItemComponent, it does not include the <li> or the clear element. I would like to be able to conditionally change the background of the items.

While I can not find this documented, the code does allow the option to contain a property disabled, see https://github.com/cibernox/ember-power-select/blob/master/addon/components/power-select-multiple/trigger.hbs#L9

Could we extend this to a property named className perhaps to allow for

<li class="ember-power-select-multiple-option {{opt.className}} {{if opt.disabled "ember-power-select-multiple-option--disabled"}}">

Should there be other things added in the future (aria-labels maybe) should we change this to a single property to allow more customizable options to be added while only reserving one property name. For example

<li class="ember-power-select-multiple-option {{opt.powerSelectItem.className}} {{if opt.powerSelectItem.disabled "ember-power-select-multiple-option--disabled"}}">

This would be a breaking change, but an or in the if would allow for backward compatibility. We could temporarily add a did-insert to the <li> element that could do a check and deprecate the disabled property until the next release and then remove.

Would be happy to do a PR an approval was given for which direction to take, respect a className property or create a powerSelectItem property and put className there and move disabled.

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

No branches or pull requests

1 participant