A set of components for creating customizable modal dialogs with smooth transitions.
ModalDefault ExampleModalButton ExampleThese components provide an easy way to create modal dialogs with smooth transitions in your Vue.js application.
The ModalButton component creates a button that, when clicked, opens a modal dialog. It manages its own open/close state and provides slots for both the button content and the modal content.
| Prop | Type | Default | Description |
|---|---|---|---|
open | Boolean | false | Controls the initial open state of the modal. |
| Slot | Description |
|---|---|
default | Content for the modal body (ModalDefault only). |
button | Content for the button that opens the modal (ModalButton only). |
| Event | Description |
|---|---|
handleClose | Emitted when the modal is closed (ModalButton only). |
The ModalDefault component creates a modal dialog without an associated button. It's useful when you want to control the modal's visibility from a parent component.
| Prop | Type | Default | Description |
|---|---|---|---|
open | Boolean | false | Controls the initial open state of the modal. |
| Slot | Description |
|---|---|
default | Content for the modal body (ModalDefault only). |
button | Content for the button that opens the modal (ModalButton only). |
| Event | Description |
|---|---|
handleClose | Emitted when the modal is closed (ModalButton only). |
Both modal components use Vue's <Transition> component for smooth enter/leave animations. You can customize the transitions by modifying the CSS classes in the component's <style> section.
These modal components implement some basic accessibility features:
For better accessibility, consider adding:
aria-labelledby and aria-describedby attributes to the modal contentModalButton when you want a self-contained modal with its own trigger button.ModalDefault when you need more control over the modal's open state or want to trigger it from multiple places.