Create modal dialogs with different styles and transitions.
Use the vk-modal
component to render a modal and an overlay that blanks out the page. The modal display is controlled with the show
prop.
<vk-modal show>
<vk-modal-title></vk-modal-title>
</vk-modal>
Note In the demo we are setting the show
prop with a sync modifier to give the modal the possibility to control the display.
The vk-modal-close
component renders a close button element that could be placed inside the modal. To place the close button outside the modal, add the outside
prop.
<vk-modal>
<vk-modal-close></vk-modal-close>
</vk-modal>
<vk-modal>
<vk-modal-close outside></vk-modal-close>
</vk-modal>
To vertically center the modal dialog, add the center
prop.
<vk-modal center></vk-modal>
To divide the modal into different content sections, use the header
and footer
slots.
<vk-modal>
<vk-modal-title slot="header"></vk-modal-title>
<div></div>
<div slot="footer"></div>
</vk-modal>
Set the size
prop to container
to expand the modal dialog to the default container width.
<vk-modal size="container">...</vk-modal>
To create a modal that fills the entire page, use the vk-modal-full
component. It is also recommended to use the vk-modal-full-close
component for the close button, so that it adapts its styling.
<vk-modal-full>
<vk-modal-full-close></vk-modal-full-close>
...
</vk-modal-full>
Using the grid and UIkit width classes, you can create a nice, split fullscreen modal.
By default, the page will scroll with the modal if its content exceeds the window height. To apply a scrollbar inside the modal, set the overflow-auto
prop.
<vk-modal overflow-auto>...</vk-modal>
You can group multiple modals by linking from one to the other and back. Use this to create multistep wizards inside your modals.
<vk-modal :show="show1">
<vk-button @click="show2 = true">Next</vk-button>
</vk-modal>
<vk-modal :show="show2">
<vk-button @click="show1 = true">Previous</vk-button>
</vk-modal>
Name | Type | Default | Description |
---|---|---|---|
show | Boolean | false | The display state. Keep it synced with sync binding modifier. |
stuck | Boolean | false | Determines if the modal should be kept open when the background was clicked. |
overflowAuto | Boolean | false | Determines if the modal should auto-adjust the height overflow. |
center | Boolean | false | Vertically centers the modal dialog. |
size | String | -- | Determines the modal dialog size. With options as container or some of the UIkit width classes. |
stack | Boolean | false | When a modal is stacked it will not close any previous modal when being displayed. |
Name | Type | Default | Description |
---|---|---|---|
large | Boolean | false | Displays a larger icon. |
outside | Boolean | false | Displays the icon outside the modal dialog. |
Name | Type | Default | Description |
---|---|---|---|
large | Boolean | false | Displays a larger icon. |