-
Notifications
You must be signed in to change notification settings - Fork 37
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
Can not override default styles - CSS class multiplication #140
Comments
Thanks for letting me know. Having default easily overridable component styles has been quite the pain tbh. Might have to revert #126. Will do a bit of searching for alternatives first. |
Btw, there's an related issue about this on the Svelte repo: sveltejs/svelte#4374 |
Im unable to overwrite the default css with Tailwind aswell. This is the generated HTML. <ul class="options bg-slate-800 svelte-1momp8n"><li class="svelte-1momp8n" aria-selected="false">JavaScript </li></ul> In my sveltekit app I add this. <MultiSelect
outerDivClass="input rounded-md"
ulOptionsClass="bg-slate-800"
>
<TypeSlot let:option {option} slot="selected" />
</MultiSelect> "svelte-multiselect": "^8.2.0" |
@B3Kay Sadly, there's nothing I can do to change the order of the classes. Svelte applies its component scoping styles last and there's no way to apply additional classes after that afaik (except by doing it through JS at run time which would cause flashing styles and be a can of worms). I'm not a Tailwind user myself but I had assumed it would work the same way as applying any other classes that are defined by global CSS. That does work as you can see in this example: https://multiselect.janosh.dev/css-classes#external-css-classes |
@B3Kay If I remember correctly, using bootstrap classes to override deafult styles did not work for me as well. |
This happens unfortunately in the demo aswell: |
@B3Kay Good catch. I hadn't looked at that example in a while and it's not tested. You can fix that by appending |
Hello,
I want to use this component, but I have problem overriding default styles. After some dubbuging and reading this discussion about style preprocessing I've found that prefix css class generated by svelte for style scoping gets multiplied in resulting css (from
:where(div.multiselect)
to this.svelte-19kmkoq.svelte-19kmkoq.svelte-19kmkoq.svelte-19kmkoq:where(div.multiselect)
. Due to the high specificity of this selector it is hard to override it with my custom class.I am not sure, but I think it has to do with scss preprocessing. Can you fix this or provide some workaround?
currently generated CSS:
CSS generated in v6:
The text was updated successfully, but these errors were encountered: