-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Passed down class contains no css-rules and is recognized by compiler as unused, "Unused CSS selector" warning in console #7763
Comments
And an additional note: i tried wrapping a child component in a div as a workaround, and then styling the child through the wrapper-div, like this
and it didn't work - environment's behavior is the same :-( |
You cannot specify a class to Svelte component. https://svelte.dev/docs#component-format-style Also, maybe CSS variables helps you. |
hello, sir ty for responding so quickly i'll look deeper into theses materials you linked however, i'm very confused - this example i linked in the "Reproduction" section describes exactly the behavior i wanted to implement:
so, i don't know what conclusions to make? is the example outdated? has it always been wrong? or maybe i misunderstood it and "Passing down classes to component" in example's title means smth else entirely? |
oh, i think i figured it out the example from REPL is NOT an official svelte-team example it's a random hosted code that Google finds for a "svelte pass class to component" search query again, ty for your time |
for anyone stumbling on this issue one possible way to implement styling of a child component in svelte is this aka
|
Describe the bug
When composing svelte components, a class passed from parent-component to child-component as a prop is
Reproduction
basic, no-code reproduction
manual reproduction
Logs
No response
System Info
Severity
blocking all usage of svelte
The text was updated successfully, but these errors were encountered: