Replies: 4 comments 8 replies
-
holderRender 能用吗? |
Beta Was this translation helpful? Give feedback.
3 replies
-
|
Beta Was this translation helpful? Give feedback.
1 reply
-
感觉 App 天然支持的效果挺好的,不需要在 CP 上做,可以考虑调整一下文档描述。 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Motivation
We supported css var since
v5.12.0
. By configuringtheme
in ConfigProvider, the style of components will be particialy replaced by css var. With this feature, use can consume Design Token not only byuseToken
in react function components, but also byvar()
in css files, which means without cssinjs users could also consume Design Token now.However, due to the implementation of css var of antd, the css vars are attached to components of antd by specialize class
css-var-xxx
. Styles like this will be generated:This brings us a new problem that if user want to consume such theme from antd's ConfigProvider, but there's no component of antd wraps, the wrong theme, which could be from parent ConfigProvider, would be consumed.
So, by supporting
component
in ConfigProvider, we could declare the scope of css var by the time we defined it withtheme
.API
Props:
Example
This will generate DOM:
Detailed Design
Question: should
component
be inherited?Drawbacks
This could resolve the problem of consuming css var, but users should be aware of that the naming of css var would be changed by prefixCls, which means it is dynamic, depends on the configuration of ConfigProvider. Since css file (no matter less or sass or other pre-processors) is static, there are risks to consume css var in this way.
Alternatives
Beta Was this translation helpful? Give feedback.
All reactions