Vue Bootstrap Modal
Vue Modal - Bootstrap 4 & Material Design
Note: This documentation is for an older version of Bootstrap (v.4). A
newer version is available for Bootstrap 5. We recommend migrating to the latest version of our product - Material Design for
Bootstrap 5.
Go to docs v.5
Vue Bootstrap modal is a dialog box/popup window which can be used for lightboxes, user notifications, UI enhancements, e-commerce components and many other cases.
It's easily customized. You can manipulate size, position, and content.
Basic example
Below is the most basic Modal example with a button triggering Modal. Click the button to trigger Modal.
Position and size
To change the position or size of the modal add one of the following props to the
modal
component.
Central modal
Note: Medium size is a default value, so there isn't a dedicated prop for it.
size="sm"
Small Modal
size="lg"
Large Modal
size="fluid"
Full Width Modal
Code example:
Side modal
Note: To make it works properly, apart from adding a prop for a position, you also need to add
special
side
prop to the
modal
component.
side
+
position="top-right"
Top Right
side
+
position="top-left"
Top Left
side
+
position="bottom-right"
Bottom Right
side
+
position="bottom-left"
Bottom Left
Code example:
Fluid modal
Note: As in the previous example - to make it works properly, apart from adding a prop for a
position,
you also need to add special prop
fullHeight
to
modal
component.
fullHeight
+
position="right"
Right
fullHeight
+
position="left"
Left
fullHeight
+
position="bottom"
Bottom
fullHeight
+
position="top"
Top
Code example:
Frame modal
Note: As in the previous examples - to make it works properly, apart from adding a prop for a
position,
you also need to add special prop
frame
to
modal
component.
frame
+
position="bottom"
Bottom
frame
+
position="top"
Top
Code example:
Remove backdrop
To remove backdrop add removeBackdrop
prop to the modal component
Scrolling long content
When modal become too long for the user’s viewport or device, it scrolls independently of the page itself. Try the demo below.
You can also create a scrollable modal that allows scroll the modal body by adding
scrollable
property.
Vertically centered
Add
centered
prop to
modal
to vertically center the modal.
Tooltips and popovers
Tooltips and popovers can be placed within modals as needed. When modals are closed, any tooltips and popovers within are also automatically dismissed.
Note: Remember to initialize tooltips/popovers. You can find more information in the Tooltips and popovers documentation.
Using the grid
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.
Varying modal content
Vue Modal - API
In this section you will find advanced information about the Modal component. Which modules are required? What are the customization possibilities of modals? Finally - what events and methods can be used within?
Modal components import statement
In order to use the component make sure you have imported it properly.
Modal
The table below shows the configuration option props of the Modal component.
Name | Type | Default | Description |
---|---|---|---|
tag |
String | div |
Allows to substitute native element's tag |
show |
Boolean | true |
Makes modal visible |
side |
Boolean | false |
Makes modal a side-positioned one |
position |
String | -- |
Determinates modal's position relative to the browser window |
centered |
Boolean | -- |
Center modal vertically and horizonally |
fullHeight |
Boolean | false |
Makes the modal take full height from a specified side |
frame |
Boolean | false |
Turns modal into a frame-type one |
removeBackdrop |
Boolean | false |
Removes the dark overlay from the background, along its functionality |
cascade |
Boolean | false |
Allows for a cascading nature of a modal |
avatar |
Boolean | false |
Gives modal styling fitting perfectly with avatar-based heading |
tabs |
Boolean | false |
Provides styles necessary for having a tab navigation in modal's header |
success |
Boolean | false |
Styles modal in a success-notification fashion |
info |
Boolean | false |
Styles modal in a info-notification fashion |
warning |
Boolean | false |
Styles modal in a warning-notification fashion |
warning |
Boolean | false |
Styles modal in a warning-notification fashion |
elegant |
Boolean | false |
It helps to style modal so it is slick and elegant |
dark |
Boolean | false |
Determines whether style of a modal should not have a dark nature |
bgSrc |
String | null |
Dark style necessitate having a picture background, but the feature is for all the modals, really |
scrollable |
Boolean | false |
Allows to scroll through long contents with a scrollbar |
direction |
String | "top" |
Allows to change a transition's direction. |
ModalHeader
Name | Type | Default | Description |
---|---|---|---|
tag |
String | div |
Allows to substitute native element's tag |
close |
Boolean | true |
Turning it to false gets rid of the close "x" icon in the right top conrner |
color |
String | -- |
Determines color of the header |
textColor |
String | -- |
Helps to set font color |
ModalBody
Name | Type | Default | |
---|---|---|---|
tag |
String | div |
Allows to substitute native element's tag |
ModalFooter
Name | Type | Default | Description |
---|---|---|---|
tag |
String | div |
Allows to substitute native element's tag |
start |
Boolean | false |
Makes the ModalHeader contents align to the left |
end |
Boolean | false |
Makes the ModalHeader contents align to the right |
closeAriaLabel |
Boolean | false |
Makes the ModalHeader contents align with space between them |
titleClasses |
Boolean | false |
Makes the ModalHeader contents align with space around them |