ng-bootstrap Modal size

前端 未结 9 2166
抹茶落季
抹茶落季 2020-12-29 18:25

What is the best way to set/override a custom width for a modal?

It seems ng-bootstrap currently supports

size: \'sm\' | \'lg\'

9条回答
  •  既然无缘
    2020-12-29 19:14

    The cleanest solution that I could find is to use the windowClass property.

    I.e.:

    this.modalService.open(MyModalComponent,  { windowClass : "myCustomModalClass"});
    

    Then add the following to your global CSS styles. This is important as the style won't be picked up from your components CSS.

    .myCustomModalClass .modal-dialog {
      max-width: 565px;
    }
    

提交回复
热议问题