-
Notifications
You must be signed in to change notification settings - Fork 7
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
Expose component CSS custom properties #66
Comments
Hi, @kafwangure |
@alexprey here is an example in the REPL In terms of output, I think we can put this in |
Example library component <button class="css-api class-i-dont-want-you-to-use">
<slot/>
</button>
<style>
.css-api {
/** @random doc comment */
--button-width: 100px;
--unused-value-wont-help-you: auto;
}
.class-i-dont-want-you-to-use {
width: var(--button-width, 100px);
color: var(--global-color-you-shouldnt-care-about);
}
</style> Example usage: <form>
<input type="password"/>
<Button --button-width="120px">Submit</Button>
</form>
<style>
form :global(.css-api) {
--button-width: 120px;
}
</style> Example docs {
css_vars: [
{ name: "--button-width", value: "120px", defined: true, used: true, },
{ name: "--global-color-you-shouldnt-care-about", defined: false, used: true },
{ name: "--unused-value-wont-help-you": value: "auto", defined: true, used: false },
],
}, ...but also including the Depending on someone's use case then, they can document their desired vars. For example, I imagine many will only display docs if var is I admittedly haven't thought too much about uses cases beyond what I have personally needed before. |
Wow, miss it from official documentation! Thanks for raising the issue 😸 So, based on it, I think that it should be a new item in
From techical side it should be a new parser - That a complex task, so, can't promise to done it quick, but try to do that. |
It'd be helpful to expose custom properties inside a component for easier documentation. Particularly with the addition of the
<Component --css-var="var"/>
syntax.It would be even more helpful if custom properties that are defined in the component (e.g
--value: 24px
) were somehow distinguishable from custom properties that are only used in the component (e.gvalue : var(--from-global-scope);
)The text was updated successfully, but these errors were encountered: