Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change ngx bootstrap modal width?

How can I set the width to my ngx bootstrap modal, I've tried but like It is fixed?

Here's the html

    <div bsModal #childModal="bs-modal" class="modal fade" tabindex="-1" 
     role="dialog" [config]="{backdrop: 'static'}" aria-hidden="true">
    <div class="modal-dialog modal-sm">
    <div class="modal-content">
        <div class="modal-body text-center">
            <button type="button" class="close" data-dismiss="modal" aria-
    label="Close" (click)="hide()"><span aria-hidden="true">&times;</span>
     </button>
            <h4 class="modal-title" id="myModalLabel">Are you sure?</h4>
            <div class="modal-footer">
                <div class="col-xs-6 no-padding-left">
                    <button type="button" id="dialog_no" class="btn btn-
        default btn-block" data-dismiss="modal" (click)="hide()">No</button>
                </div>
                <div class="col-xs-6 no-padding-right">
                    <button type="button" id="dialog_yes" class="btn btn-
     primary btn-block ladda-button" data-style="expand-right" 
     (click)="confirm()">Yes</button>
                </div>
            </div>
        </div> 
    </div>
     </div>
  </div>

How can I set the width of the modal for buttons to be placed just on the edge of the modal, with lets say 5 px of border margin?

modal bootstrap

I haven't put any styling yet in my css file, even tho I've tried to modify the width but didn't I guess know how...

like image 469
code_newbie23 Avatar asked Mar 13 '18 22:03

code_newbie23


People also ask

How do I change the size of a bootstrap modal?

Change the size of the modal by adding the . modal-sm class for small modals, . modal-lg class for large modals, or . modal-xl for extra large modals.

How do you reduce the width of a modal?

Answer: Set width for . modal-dialog element Similarly, you can override the width property of . modal-sm , . modal-lg and . modal-xl class to resize the small, large and extra-large modal dialog box respectively.

How do you increase modal size in Reactstrap?

The docs reactstrap really bad to explained. Don't forget everyone, you can also do size="xl" . To achieve greater sizes than this, you have to use a stylesheet imported and on the Modal component itself, specifically a property called contentClassName . By writing to a separate file like styles.

How can I get modal responsive height?

Making your Modal Responsive The most obvious way is to write a bunch of media queries like a chump. I instead suggest using max-width and max-height. When combined with calc() this allows you to have a consistent padding between the modal and the edge of the screen on smaller devices.

How to change Bootstrap 3 modal size properties?

Changing Bootstrap 3 modal size properties. In order to increase or decrease the modal window height and width properties of Bootstrap, you need to get the modal related classes and use desired values either in the <style> section or in your external CSS file. Change width demo Height & Width example Bootstrap 4 Modal

How to change the size of the modal window in CSS?

However, if you still want to customize the size of the modal window you can override the CSS width property of the .modal-dialog class to resize the default modal. Similarly, you can override the width property of .modal-sm, .modal-lg and .modal-xl class to resize the small, large and extra-large modal dialog box respectively.

What is Bootstrap modal in Bootstrap?

Bootstrap Modal: It is a dialog window that opens inside the browser window on triggering certain events. It is a really convenient way to improve the website’s content rendering as per the requirements. In this article, we will focus on adjusting the width/height of the modal box.

How to resize a modal in WordPress?

As minimize icon is clicked, the modal will resize towards the left bottom. Along with this, the modal height and width properties are also changed than default. This is again done by using the .modal-dialog class where width and height of the overall modal are set. Besides, the .modal-content class is also used for setting the content area.


2 Answers

On your method call for the modal, you can setup a configuration object with the ModalOptions class that also comes with ngx-bootstrap. Within that, the 'class' property allows you to pass classes which will be appended.

const config: ModalOptions = { class: 'modal-sm' };
this.bsModalRef = this.modalService.show(YourComponent, config);

hope this helps

like image 122
jgritten Avatar answered Nov 11 '22 18:11

jgritten


When creating a modal, pass your css class to options like this:

this.modalService.show(template, { class: 'modal-lg' });
like image 25
Savan Gadhiya Avatar answered Nov 11 '22 18:11

Savan Gadhiya