-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Add type annotation to the styles property of components to allow inherited styles #828
Comments
I'm OK with this change. If you submit a PR, please update the Plop template in But one heads up:
You might want to read the discussion in #705, specifically this comment.
By changing tag names, many components will break some will not be obvious at first. Button, for example, relies on At this time, I don't recommend renaming Shoelace tags or extending them in this way. |
Thank you for the hint, it was really helpful! Also, the PR is created and ready for review 👍 |
Fixed in #829. Thanks for the PR! |
What issue are you having?
I would like to create some components of my own on top of the Shoelace components.
To do this I already created an derivation of the
SlButton
class which looks like this:My main goal was to add some styles for now and some functionality in the future. To add styles to the derived component I followed the documentation of Lit.
This resulted in an type check error for my components. I have to implement the
static styles
property as aCSSResultGroup
to add my own styles. This makes myCSSResultGroup
property not compatible with theCSSResult
used in theSlButton
base class.Describe the solution you'd like
Excerpt from the Google Lit documentation:
If you want me to help I'm really happy to add the type annotations myself and submit a PR :)
I would modify the components like this:
Which would result in a declaration like this:
(Already tested on my local environment)
Describe alternatives you've considered
An alternative would be to write derivations like this:
I don't think I have to go further into detail why I don't really like this solution as it effectively makes the type validation for this property useless.
Just a little words on the side:
Thank you for this amazing project. The Shoelace library is the best web component library I've ever used by far. I would be really happy to contribute by solving this issue.
The text was updated successfully, but these errors were encountered: