sveltejs / svelte

web development for the rest of us
https://svelte.dev
MIT License
80.04k stars 4.26k forks source link

Merge Classes in Svelte #14259

Closed K1ender closed 1 week ago

K1ender commented 1 week ago

Describe the problem

In Svelte, when passing class attributes from a parent component to a child component, the behavior does not automatically merge classes as it does in Vue.js. This can lead to situations where classes defined in the parent are not combined with classes defined in the child, especially when the child component has its own predefined classes.

Describe the proposed solution

I would like Svelte to automatically merge class attributes passed from a parent component to a child component, similar to how Vue.js handles class merging.

Importance

would make my life easier

Prinzhorn commented 1 week ago

This has come up countless times, e.g. https://github.com/sveltejs/svelte/issues/2870 or https://github.com/sveltejs/svelte/issues/5236 or https://github.com/sveltejs/svelte/issues/7776