1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Can I use antd less variable in my component?

Discussão em 'Angular' iniciado por WheelJS, Setembro 23, 2024.

  1. WheelJS

    WheelJS Guest

    Question


    I'm using NG-ZORRO to make UI more standard.

    I have a business component and I want to align the primary color with Ant Design. I saw Theming Your Own Components in Angular Material, but I didn't find a solution for NG-ZORRO yet. When I use @primary-color in my components' style file(e.g. test.component.less), I got an error: Variable @primary-color is undefined.

    How can I reference NG-ZORRO less variable in my own component?

    My Solution


    I found a solution, but I am not sure it is elegant.

    In component less, I imported path/to/ng-zorro-antd/style/themes/default.less at first line, then border: 1px solid @primary-color worked as well.

    Is it a right way for using NG-ZORRO less variable in my component?

    Continue reading...

Compartilhe esta Página