Hi @ef4, thank you for your response.
The first question is - where should I specify tagName=div
, - I don’t have any component, just a controller, router and a template (all of application*
) .
Then I tried to specify @triggerClass
as follows in the application
template:
<PowerSelect
@triggerClass="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 md:m-4 py-1 px-2 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
@selected={{destination}}
@options={{cities}}
@onChange={{action (mut destination)}}
as |name|>
{{name}}
</PowerSelect>
what generated the following HTML for ember-power-select without really modifying its width:
<div class="ember-view ember-basic-dropdown-trigger ember-power-select-trigger block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 md:m-4 py-1 px-2 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500" role="button" tabindex="0" data-ebd-id="ember190-trigger" aria-owns="ember-basic-dropdown-content-ember190">
As you could see, there some ember-power-select proper styles which, I think override the ones of tailwind. Even if some of them have been applied.
Here is how looks a classic select element styled with tailwind:
And here is how looks the ember-power-select with the same styles applied to @triggerClass
:
Applying the same css using @dropdownClass
in ember-power-select options changed less and generated the following HTML, - as you see, no tailwind styles have been applied at all:
<div class="ember-view ember-basic-dropdown-trigger ember-power-select-trigger" role="button" tabindex="0" data-ebd-id="ember190-trigger" aria-owns="ember-basic-dropdown-content-ember190">
I also tried to apply the styles as follows:
<PowerSelect
@tagName="div"
@class="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 md:m-4 py-1 px-2 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
@selected={{destination}}
@options={{cities}}
@onChange={{action (mut destination)}}
as |name|>
{{name}}
</PowerSelect>
what changed the select as follows:
and generated the following HTML:
<div id="ember190" class="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 md:m-4 py-1 px-2 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500 ember-view">
<div class="ember-view ember-basic-dropdown-trigger ember-power-select-trigger" role="button" tabindex="0" data-ebd-id="ember191-trigger" aria-owns="ember-basic-dropdown-content-ember191">
<span class="ember-power-select-selected-item">
Missouri
...
By the way, setting theme
to false
in ember-cli-build.js
:
module.exports = function(defaults) {
let app = new EmberApp(defaults, {
'ember-power-select': {
theme: false
},
postcssOptions: {
compile: {
plugins: [
require('tailwindcss')
]
}
}
});
removed some styles and visually the generated select element looks the same, except its width:
I think that the main difference is that ember-power generates 2 divs compared to select
element I’m using on a classic page.
What am I missing here?