Yep - style props in Svelte are just syntactic sugar for setting CSS vars on a div. So <TextBox --line-color="mediumspringgreen"></TextBox> de-sugars into
I am working as a web developer for nearly 20 years. I care a lot about simple and maintainable code that is fun to work with, good documentation and clean APIs.
Do IDEs assist with that? For regular props its fairly easy since they are announced with export let foo; but how does it work for style props? Or do I need to assign them blindly?
For now, there's no way for component authors to specify which style props are available, aside from documentation. There's an open issue on the Svelte language tools (which makes IDE autocomplete work) to implement this feature.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yep - style props in Svelte are just syntactic sugar for setting CSS vars on a div. So
<TextBox --line-color="mediumspringgreen"></TextBox>
de-sugars intoSo the CSS vars will cascade to child elements like normal.
More details in the docs.
Thanks for the clarification!
Do IDEs assist with that? For regular props its fairly easy since they are announced with
export let foo;
but how does it work for style props? Or do I need to assign them blindly?For now, there's no way for component authors to specify which style props are available, aside from documentation. There's an open issue on the Svelte language tools (which makes IDE autocomplete work) to implement this feature.