-
Notifications
You must be signed in to change notification settings - Fork 794
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
feat: html / css components #6159
Comments
Would the usage be like this then: <my-card variant="primary">
<button>...</button>
</my-card> ? |
Essentially, although there's 2 different examples mentioned. A general styled block: <my-card variant="primary">
<!-- anything -->
</my-card> (^ perhaps the component jsdoc could add more information about available elements / nested classes supported) And a more prescriptive block which only supports a couple of nested elements: <my-button variant="primary">
<button>A button</button>
<!-- or -->
<a>a link</a>
</my-button> (^ css would only target Thinking more on it, perhaps a full ts class in this situation is too misleading and it should just be a more ergonomic way to include the types / js docs in final outputs |
First off, just learned about the Would functional components be an alternative? For Example: @Component({ styleUrl: 'my-card.css' })
export const MyCard = ({ variant }: { variant: "primary" | "secondary" }, children) => <>
<!-- anything -->
{children}
</>; This assumes:
It seems like more work but makes sense from the semantic POV, thoughts? |
Prerequisites
Describe the Feature Request
CSS Web components or HTML web components are increasingly popular.
Stencil could provide some quality of life for devs; allowing them to integrate this pattern into the Stencil build chain.
Describe the Use Case
Some components within a design system, just don’t require any js runtime at all.
A ‘my-card’ or for example, could just be hook for some css. A ‘my-button’ could just be a styling wrapper around a ‘button’.
It’s quite possible to augment Stencil’s ‘components.d.ts’ with plain types, a la
But I don’t think this would pass into framework wrapper outputs for autocomplete, documentation etc etc.
Describe Preferred Solution
Something like
Would add 'my-card' to all the docs / types outputs including the prop jsdocs.
Any styles could automatically be added to the
global.css
- it could even automatically add styles within something likeI realise omitting
shadow: true
andscoped: true
to mean 'no js runtime / css only' would be a breaking change, so we can discuss alternatives ( e.g.cssOnly: true
etc)Describe Alternatives
Todo
Related Code
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: