Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng-bootstrap Modal border-radius

What is the best way to customize the border-radius of the NgBoostrap modal?

<ng-template #content let-c="close" let-d="dismiss">
    <div class="modal-header">
        <h4 class="modal-title" id="modal-basic-title">Test</h4>
        <button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>
    <div class="modal-body">
        <p>Hello, World!</p>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-outline-dark" (click)="c('Save click')">Save</button>
    </div>
</ng-template>
like image 854
Soury Avatar asked Sep 05 '26 05:09

Soury


2 Answers

I went to my component's typescript and put this:

this.modalService.open(content, {centered: true, windowClass: 'modal-rounded', size: 'lg'});

Soon after I went to my main scss (styles.scss) and put this code there:

.modal-rounded {
    .modal-content {
      border-radius: 20px !important;
    }
  }
like image 95
Soury Avatar answered Sep 08 '26 01:09

Soury


You just need to add border-radius to modal-content class:

.modal-content{
    border-radius: 50px;
}
like image 34
Saghi Shiri Avatar answered Sep 08 '26 03:09

Saghi Shiri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!