Dialog
Basic Usage
The Dialog component allows you to display modal dialogs with ease. It provides flexibility in positioning,
animations, size, and more.
To get started, you need to control the visibility of the dialog using the v-model directive and customize other
options like size, position, and more.
Control Visibility
Use the v-model directive to bind the dialog's visibility to a reactive variable.
Dialog Size
You can adjust the size of the dialog using the size prop. Available options are xs, sm, md, lg, xl, 2xl,
3xl, and more.
Positioning
Control where the dialog appears on the screen using the position prop. Options include center, top, bottom,
left, right, or combinations like top-left.
Close Button
Enable a close button inside the dialog by setting the closeButton prop to true.
Background Interaction
Prevent the dialog from closing when clicking the background using the notCloseBackground prop. This is particularly
useful for scenarios where the user must provide input or take a specific action (e.g., clicking a button) before the
dialog can be dismissed. It ensures that the dialog remains open until an explicit interaction occurs.
notCloseBackground prop without also enabling the closeButton prop or providing an
internal button tied to an explicit dialog close action. Failure to do so will result in a dialog that cannot be closed,
as clicking the background will not dismiss it.Removing Margins
If you want the dialog to have no default margin, set the withoutMargin prop to true.
Disabling Animations
Disable all animations for the dialog by enabling the notAnimate prop.
Teleport Target
Specify where the dialog should be rendered in the DOM using the toTeleport prop. The default is "body".
Custom Classes
Customize the dialog’s appearance using the class and classBody props.
Background Customization
You can customize the background of the dialog using the background slot or apply custom styles to the background. The
background can be styled in any way you like, providing flexibility for your design needs.
For instance, if you declare the background slot but leave it empty, the dialog will have no background at all,
resulting in a completely transparent background. This can be useful for creating minimalistic or fully custom visual
effects.
You can also add a styled background by defining custom content in the background slot.