Appearance
GDialog
import { GDialog } from 'gitart-vue-dialog'
The component uses the Vue 3 teleport to move the component html to <body>.
z-index of the component is 200. So be careful. Don't make z-index of the header or other element like this:
z-index: 9999
Props
| Name | Type | Default |
|---|---|---|
| background | boolean string | true |
| border-radius | boolean number string | true |
| close-on-back | boolean | false |
| content-class | string | '' |
| depressed | boolean | false |
| fullscreen | boolean | false |
| height | string number | 'auto' |
| local | boolean | false |
| max-width | string number | 'none' |
| model-value | boolean | false |
| no-click-animation | boolean | 'false' |
| overlay-background | boolean string | true |
| persistent | boolean | false |
| scrollable | boolean | false |
| transition | string | g-dialog-transition |
| width | string number | 'auto' |
background
Type:
Boolean | StringDefault:
trueDetails:
Sets background to the dialog contenttrue- remains default background,false- removes backgroundString- sets some background to the current dialog content
You can set default value for all dialogs by CSS var --g-dialog-content-bg
border-radius
Type:
Boolean | Number | StringDefault:
trueDetails:
Sets border-radius to the dialog contenttrue- remains default border-radius,false- removes border-radiusString- sets some border-radius to the current dialog content
You can set default value for all dialogs by CSS var --g-dialog-content-border-radius
close-on-back
Type:
BooleanDefault:
falseDetails:
Allows to close the dialog by navigating back. It's adding hash to the url when the dialog is open.
content-class
Type:
StringDefault:
''Details:
Applies the class to the content (div that wraps the main slot)
depressed
Type:
BooleanDefault:
falseDetails:
Disables default box-shadow
fullscreen
Type:
BooleanDefault:
falseDetails:
Enables a fullscreen mode for the dialog.
height
Type:
String | NumberDefault:
'auto'Details:
Sets height for the dialog
local
Type:
BooleanDefault:
falseDetails:
Enables the local mode. The dialog will not be teleported to the body and will be positioned likeabsoluteinstead offixed. Be sure to specifyposition: relative;for the parent element where you place the dialog.The props can be useful if you want to show some windows above a specific part of your app.
v1.2.0+
max-width
Type:
String | NumberDefault:
'none'Details:
Sets max-width for the dialog
model-value
Type:
BooleanDefault:
falseDetails:
v-model props to activate and deactivate the dialog
no-click-animation
Type:
BooleanDefault:
falseDetails:
Disables the bounce effect when clicking outside of a dialog's content when using the persistent prop.
v2.0.0+
overlay-background
Type:
Boolean | StringDefault:
trueDetails:
Sets dialog overlay background.true- remains default background,false- removes backgroundString- sets some background to the current dialog overlay
You can set default value for all dialogs by CSS var --g-dialog-overlay-bg
persistent
Type:
BooleanDefault:
falseDetails:
Makes clicking outside of the element will not deactivate the dialog. Example.
scrollable
Type:
BooleanDefault:
falseDetails:
Applies thedisplay: flex;to the dialog content wrapper element. It allows you to implement scrollable content to a specific part of a dialog. Here is an example of use.
transition
Type:
StringDefault:
'g-dialog-transition'Details:
Sets the component custom transition name (leaving and entering the dialog).// transition="custom-rotate-transition" .custom-rotate-transition { &-enter-active, &-leave-active { transition-timing-function: linear; transition-duration: 0.1s; } &-enter-from { transform: translate(0, 30px) rotate(12deg); opacity: 0; } &-leave-to { transform: translate(0, 30px) rotate(4deg); opacity: 0; } }WARNING
On leaving,
transition-durationshould not be higher than plugincloseDelayoption (500msby default) if you are using plugin method addDialog.removeDialog disables a dialog and deletes it after
closeDelayms completely, so the custom transition may be truncated
width
Type:
String | NumberDefault:
'auto'Details:
Sets width for the dialog
Slots
| Name | Description |
|---|---|
| default | The default Vue slot |
| activator | When used, will activate the component when clicked |
default
Scoped Data:
{ onClose: () => {} }Details:
The prop is for your content.
onClosescoped data could help close a dialog.<GDialog> <template #default="{ onClose }"> <p>Content</p> <button @click="onClose"> close </button> </template> </GDialog>
activator
Scoped Data:
{ onClick: () => {} }Details:
The slot helps activate the component when clicked on inside element. Bind scoped data to the button.
<GDialog> <template #activator="attrs"> <button v-bind="attrs"> open </button> </template> Content </GDialog>Or you can call
onClickmanually with another event.<GDialog> <template #activator="{ onClick }"> <button @mouseenter="onClick"> open </button> </template> Content </GDialog>
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | boolean | runs with false after clicking outside |
CSS Vars Customization
The packages provide global style customization by CSS variables. Below you can see all possible variables. Just put them in your global CSS file. Like this:
:root {
--g-dialog-content-bg: #eff1f3;
--g-dialog-content-border-radius: 8px;
}
List of possible variables:
transition-duration
Name:
--g-dialog-transition-durationDefault:
0.2sDetails:
Sets defaulttransition-durationfor entering and exiting the dialog.Usage:
--g-dialog-transition-duration: 0.4s;v2.2.0+
content-bg
Name:
--g-dialog-content-bgDefault:
#fffDetails:
Sets defaultbackgroundfor the dialog contentUsage:
--g-dialog-content-bg: #282c34;
content-border-radius
Name:
--g-dialog-content-border-radiusDefault:
4pxDetails:
Sets defaultborder-radiusfor the dialog contentUsage:
--g-dialog-content-border-radius: 0;
content-shadow
Name:
--g-dialog-content-shadowDefault:
0 11px 15px -7px rgb(0 0 0 / 20%),0 24px 38px 3px rgb(0 0 0 / 14%),0 9px 46px 8px rgb(0 0 0 / 12%)Details:
Sets defaultbox-shadowfor the dialog contentUsage:
--g-dialog-content-shadow: 0 11px 15px -7px rgb(0 0 0 / 20%);
overlay-bg
Name:
--g-dialog-overlay-bgDefault:
rgba(33, 33, 33, 0.46)Details:
Sets defaultbackgroundfor the dialog overlayUsage:
--g-dialog-overlay-bg: rgba(143, 108, 249, 0.4);