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 | String
Default:
true
Details:
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 | String
Default:
true
Details:
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:
Boolean
Default:
false
Details:
Allows to close the dialog by navigating back. It's adding hash to the url when the dialog is open.
content-class
Type:
String
Default:
''
Details:
Applies the class to the content (div that wraps the main slot)
depressed
Type:
Boolean
Default:
false
Details:
Disables default box-shadow
fullscreen
Type:
Boolean
Default:
false
Details:
Enables a fullscreen mode for the dialog.
height
Type:
String | Number
Default:
'auto'
Details:
Sets height for the dialog
local
Type:
Boolean
Default:
false
Details:
Enables the local mode. The dialog will not be teleported to the body and will be positioned likeabsolute
instead 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 | Number
Default:
'none'
Details:
Sets max-width for the dialog
model-value
Type:
Boolean
Default:
false
Details:
v-model props to activate and deactivate the dialog
no-click-animation
Type:
Boolean
Default:
false
Details:
Disables the bounce effect when clicking outside of a dialog's content when using the persistent prop.
v2.0.0+
overlay-background
Type:
Boolean | String
Default:
true
Details:
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:
Boolean
Default:
false
Details:
Makes clicking outside of the element will not deactivate the dialog. Example.
scrollable
Type:
Boolean
Default:
false
Details:
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:
String
Default:
'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-duration
should not be higher than plugincloseDelay
option (500ms
by default) if you are using plugin method addDialog.removeDialog disables a dialog and deletes it after
closeDelay
ms completely, so the custom transition may be truncated
width
Type:
String | Number
Default:
'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.
onClose
scoped 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
onClick
manually 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-duration
Default:
0.2s
Details:
Sets defaulttransition-duration
for entering and exiting the dialog.Usage:
--g-dialog-transition-duration: 0.4s;
v2.2.0+
content-bg
Name:
--g-dialog-content-bg
Default:
#fff
Details:
Sets defaultbackground
for the dialog contentUsage:
--g-dialog-content-bg: #282c34;
content-border-radius
Name:
--g-dialog-content-border-radius
Default:
4px
Details:
Sets defaultborder-radius
for the dialog contentUsage:
--g-dialog-content-border-radius: 0;
content-shadow
Name:
--g-dialog-content-shadow
Default:
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-shadow
for the dialog contentUsage:
--g-dialog-content-shadow: 0 11px 15px -7px rgb(0 0 0 / 20%);
overlay-bg
Name:
--g-dialog-overlay-bg
Default:
rgba(33, 33, 33, 0.46)
Details:
Sets defaultbackground
for the dialog overlayUsage:
--g-dialog-overlay-bg: rgba(143, 108, 249, 0.4);