|
|
|
@@ -34,7 +34,7 @@ Keep reading for demos and usage guidelines.
|
|
|
|
|
Below is a _static_ modal example (meaning its `position` and `display` have been overridden). Included are the modal header, modal body (required for `padding`), and modal footer (optional). We ask that you include modal headers with dismiss actions whenever possible, or provide another explicit dismiss action.
|
|
|
|
|
|
|
|
|
|
<div class="bd-example bd-example-modal">
|
|
|
|
|
<div class="modal" tabindex="-1" role="dialog">
|
|
|
|
|
<div class="modal" tabindex="-1">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -56,7 +56,7 @@ Below is a _static_ modal example (meaning its `position` and `display` have bee
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{% highlight html %}
|
|
|
|
|
<div class="modal" tabindex="-1" role="dialog">
|
|
|
|
|
<div class="modal" tabindex="-1">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -81,7 +81,7 @@ Below is a _static_ modal example (meaning its `position` and `display` have bee
|
|
|
|
|
|
|
|
|
|
Toggle a working modal demo by clicking the button below. It will slide down and fade in from the top of the page.
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="exampleModalLive" tabindex="-1" role="dialog" aria-labelledby="exampleModalLiveLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModalLive" tabindex="-1" aria-labelledby="exampleModalLiveLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -114,7 +114,7 @@ Toggle a working modal demo by clicking the button below. It will slide down and
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<!-- Modal -->
|
|
|
|
|
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -139,7 +139,7 @@ Toggle a working modal demo by clicking the button below. It will slide down and
|
|
|
|
|
|
|
|
|
|
When backdrop is set to static, the modal will not close when clicking outside it. Click the button below to try it.
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="staticBackdropLive" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLiveLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="staticBackdropLive" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLiveLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -172,7 +172,7 @@ When backdrop is set to static, the modal will not close when clicking outside i
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<!-- Modal -->
|
|
|
|
|
<div class="modal fade" id="staticBackdrop" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="staticBackdrop" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -198,7 +198,7 @@ When backdrop is set to static, the modal will not close when clicking outside i
|
|
|
|
|
|
|
|
|
|
When modals become too long for the user's viewport or device, they scroll independent of the page itself. Try the demo below to see what we mean.
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="exampleModalLong" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModalLong" tabindex="-1" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -243,7 +243,7 @@ When modals become too long for the user's viewport or device, they scroll indep
|
|
|
|
|
|
|
|
|
|
You can also create a scrollable modal that allows scroll the modal body by adding `.modal-dialog-scrollable` to `.modal-dialog`.
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="exampleModalScrollable" tabindex="-1" role="dialog" aria-labelledby="exampleModalScrollableTitle" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModalScrollable" tabindex="-1" aria-labelledby="exampleModalScrollableTitle" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog modal-dialog-scrollable">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -297,7 +297,7 @@ You can also create a scrollable modal that allows scroll the modal body by addi
|
|
|
|
|
|
|
|
|
|
Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModalCenter" tabindex="-1" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -317,7 +317,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="exampleModalCenteredScrollable" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenteredScrollableTitle" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModalCenteredScrollable" tabindex="-1" aria-labelledby="exampleModalCenteredScrollableTitle" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -366,7 +366,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.
|
|
|
|
|
|
|
|
|
|
[Tooltips]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/tooltips/) and [popovers]({{ site.baseurl }}/docs/{{ site.docs_version }}/components/popovers/) can be placed within modals as needed. When modals are closed, any tooltips and popovers within are also automatically dismissed.
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="exampleModalPopovers" tabindex="-1" role="dialog" aria-labelledby="exampleModalPopoversLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModalPopovers" tabindex="-1" aria-labelledby="exampleModalPopoversLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -410,7 +410,7 @@ Add `.modal-dialog-centered` to `.modal-dialog` to vertically center the modal.
|
|
|
|
|
|
|
|
|
|
Utilize the Bootstrap grid system within a modal by nesting `.container-fluid` within the `.modal-body`. Then, use the normal grid system classes as you would anywhere else.
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="gridSystemModal" tabindex="-1" role="dialog" aria-labelledby="gridModalLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="gridSystemModal" tabindex="-1" aria-labelledby="gridModalLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -501,7 +501,7 @@ Below is a live demo followed by example HTML and JavaScript. For more informati
|
|
|
|
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@fat">Open modal for @fat</button>
|
|
|
|
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="@getbootstrap">Open modal for @getbootstrap</button>
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
@@ -555,7 +555,7 @@ If you want for example a zoom-in animation, you can set `$modal-fade-transform:
|
|
|
|
|
For modals that simply appear rather than fade in to view, remove the `.fade` class from your modal markup.
|
|
|
|
|
|
|
|
|
|
{% highlight html %}
|
|
|
|
|
<div class="modal" tabindex="-1" role="dialog" aria-labelledby="..." aria-hidden="true">
|
|
|
|
|
<div class="modal" tabindex="-1" aria-labelledby="..." aria-hidden="true">
|
|
|
|
|
...
|
|
|
|
|
</div>
|
|
|
|
|
{% endhighlight %}
|
|
|
|
@@ -566,7 +566,7 @@ If the height of a modal changes while it is open, you should call `$('#myModal'
|
|
|
|
|
|
|
|
|
|
### Accessibility
|
|
|
|
|
|
|
|
|
|
Be sure to add `role="dialog"` and `aria-labelledby="..."`, referencing the modal title, to `.modal`. Additionally, you may give a description of your modal dialog with `aria-describedby` on `.modal`.
|
|
|
|
|
Be sure to add `aria-labelledby="..."`, referencing the modal title, to `.modal`. Additionally, you may give a description of your modal dialog with `aria-describedby` on `.modal`. Note that you don't need to add `role="dialog"` since we already add it via JavaScript.
|
|
|
|
|
|
|
|
|
|
### Embedding YouTube videos
|
|
|
|
|
|
|
|
|
@@ -622,7 +622,7 @@ Our default modal without modifier class constitutes the "medium" size modal.
|
|
|
|
|
<div class="modal-dialog modal-sm">...</div>
|
|
|
|
|
{% endhighlight %}
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="exampleModalXl" tabindex="-1" role="dialog" aria-labelledby="exampleModalXlLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModalXl" tabindex="-1" aria-labelledby="exampleModalXlLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog modal-xl">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
|
|
|
|
@@ -639,7 +639,7 @@ Our default modal without modifier class constitutes the "medium" size modal.
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="exampleModalLg" tabindex="-1" role="dialog" aria-labelledby="exampleModalLgLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModalLg" tabindex="-1" aria-labelledby="exampleModalLgLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog modal-lg">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
|
|
|
|
@@ -656,7 +656,7 @@ Our default modal without modifier class constitutes the "medium" size modal.
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="exampleModalSm" tabindex="-1" role="dialog" aria-labelledby="exampleModalSmLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal fade" id="exampleModalSm" tabindex="-1" aria-labelledby="exampleModalSmLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog modal-sm">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|