-
Notifications
You must be signed in to change notification settings - Fork 265
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
How to reuse a CSS variable from WC in my app? #410
Comments
I am facing a similar problem too |
Yeah, we didn't consider this usage so far and have to address it. The reason the CSS variables for the default theme are not included in the However, this is a valid use case so we have to consider the options:
option 1. might be too much in case no one is using them Until we flesh this out, you can use a workaround that implements option 2. (warning: these APIs might change and are really internal). At least that way you can start using the parameters in your code and give any feedback. import fiori3ThemeProperties from "@ui5/webcomponents/dist/themes/sap_fiori_3/parameters-bundle.css.js";
import { injectThemeProperties } from "@ui5/webcomponents-base/src/theming/StyleInjection.js";
import Bootstrap from "@ui5/webcomponents-base/src/Bootstrap.js";
// inject default CSS custom parameters in head
Bootstrap.boot().then(_ => {
injectThemeProperties(fiori3ThemeProperties);
}); Here is a working example in codesandbox: Any feedback before we implement this is welcome. |
@pskelin Consider theme designer when defining the solution |
With the latest release (1.0.0-rc.5), the CSS variables are always included as a style tag in the head so feel free to use them in your apps. Please use with caution, as it is still not clearly documented which ones are considered |
Is your feature request related to a problem? Please describe.
In my mocks, the UI designer asked for a specific
border
around a table.ui5-table
only have borders on the top and bottom.I'd like to reuse the
ui5-table
'sborder-bottom
CSS property for my instance ofui5-table
, but how can I get the exact color used while respecting the theming?.Describe the solution you'd like
I would like to create a class like this (in my app):
Describe alternatives you've considered
I could fetch the color after the table has rendered via
getComputedProperties
and set the color via javascript, but this is troublesome and can be prone to errors.Additional context
I'd like to follow the UI5 WebComponents classes and variables so we can maybe support custom themes in the future.
The text was updated successfully, but these errors were encountered: