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

When using class props built in classes has higher priority #247

Open
stepanorda opened this issue Jul 6, 2023 · 7 comments
Open

When using class props built in classes has higher priority #247

stepanorda opened this issue Jul 6, 2023 · 7 comments
Labels
DX Developer experience good first issue Good for newcomers style Anything CSS related

Comments

@stepanorda
Copy link

When I am styling something with the tailwind, a lot of built-in CSS has higher priority and I am not being able to tweak it properly.
I see 2 solutions:

  1. When you select custom classes default ones are not applied
  2. Add a prop to remove default classes

I can create a PR if you agree that this is a future you want to have.

@stepanorda
Copy link
Author

Or at the very least, default classes should come first, that will also partially solve the problem.

@janosh
Copy link
Owner

janosh commented Jul 6, 2023

@stepanorda This has come up multiple times already. If you take a look at the code, default classes already come first. E.g.

class="multiselect {outerDivClass}"

Have a look at #140 for why this is not enough. Not sure if the situation changed in Svelte v4. If not, it might in Svelte v5. If you'd like to investigate that, please do!

I see no problem with a prop to remove default classes. Happy to take a PR.

@janosh janosh added good first issue Good for newcomers DX Developer experience style Anything CSS related labels Jul 6, 2023
@janosh
Copy link
Owner

janosh commented Jul 6, 2023

Also related: #44

@stepanorda
Copy link
Author

@janosh How about changing it to something like:

export let outerDivClass = "multiselect" 
class={outerDivClass} 

that way if you set it, it will not apply the default class.

@janosh
Copy link
Owner

janosh commented Jul 6, 2023

That might result in unexpected behavior. Some might want to keep the default styles and only make slight changes. This will drop all default styles as soon as you make a tweak.

@stepanorda
Copy link
Author

So one global switch headlessMode that disables all default classes are fine by you? I can make PR for that.

@janosh
Copy link
Owner

janosh commented Jul 6, 2023

Please do! Make sure we have test coverage for it and it doesn't affect current behavior if headlessMode={false}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Developer experience good first issue Good for newcomers style Anything CSS related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants