AntD - how to use dark theme for a single component?

Deadly 提交于 2021-01-29 10:18:42

问题


So the component lib has a dark theme.
I would like to use dark style only for a single component, say a Popover. All the rest sd remain default.
Is there a way to achieve that?


回答1:


you could use less reference import feature for theming single component. Sudo code would be something like

@import (reference) "@ant-design/dark-theme"

.my-popover {
  &:extend(@popover-prefix-cls all);
}

you can find the class name @popover-prefix-cls by going into individual components styles file and checking the class

References: https://css-tricks.com/reference-imports-in-less-are-kinda-cool/



来源:https://stackoverflow.com/questions/59895977/antd-how-to-use-dark-theme-for-a-single-component

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!