diff --git a/docs/app/components/content/examples/modal/ModalFooterSlotExample.vue b/docs/app/components/content/examples/modal/ModalFooterSlotExample.vue index 08047cbcb7..ab9dfc7e68 100644 --- a/docs/app/components/content/examples/modal/ModalFooterSlotExample.vue +++ b/docs/app/components/content/examples/modal/ModalFooterSlotExample.vue @@ -10,8 +10,8 @@ const open = ref(false) - - + + diff --git a/docs/app/components/content/examples/slideover/SlideoverFooterSlotExample.vue b/docs/app/components/content/examples/slideover/SlideoverFooterSlotExample.vue index 4a5e10086e..0d027a8895 100644 --- a/docs/app/components/content/examples/slideover/SlideoverFooterSlotExample.vue +++ b/docs/app/components/content/examples/slideover/SlideoverFooterSlotExample.vue @@ -10,8 +10,8 @@ const open = ref(false) - - + + diff --git a/docs/content/3.components/modal.md b/docs/content/3.components/modal.md index e8a3f7eaa3..3ff36f91aa 100644 --- a/docs/content/3.components/modal.md +++ b/docs/content/3.components/modal.md @@ -305,13 +305,13 @@ slots: ### Programmatic usage -You can use the [`useOverlay`](/composables/use-overlay) composable to open a Modal programatically. +You can use the [`useOverlay`](/composables/use-overlay) composable to open a Modal programmatically. ::warning Make sure to wrap your app with the [`App`](/components/app) component which uses the [`OverlayProvider`](https://github.com/nuxt/ui/blob/v3/src/runtime/components/OverlayProvider.vue) component. :: -First, create a modal component that will be opened programatically: +First, create a modal component that will be opened programmatically: ::component-example --- diff --git a/docs/content/3.components/slideover.md b/docs/content/3.components/slideover.md index a55c5d2869..c73acc1ac8 100644 --- a/docs/content/3.components/slideover.md +++ b/docs/content/3.components/slideover.md @@ -304,13 +304,13 @@ slots: ### Programmatic usage -You can use the [`useOverlay`](/composables/use-overlay) composable to open a Slideover programatically. +You can use the [`useOverlay`](/composables/use-overlay) composable to open a Slideover programmatically. ::warning Make sure to wrap your app with the [`App`](/components/app) component which uses the [`OverlayProvider`](https://github.com/nuxt/ui/blob/v3/src/runtime/components/OverlayProvider.vue) component. :: -First, create a slideover component that will be opened programatically: +First, create a slideover component that will be opened programmatically: ::component-example --- diff --git a/playground/app/pages/components/modal.vue b/playground/app/pages/components/modal.vue index 0ac4a794d9..b19cc153eb 100644 --- a/playground/app/pages/components/modal.vue +++ b/playground/app/pages/components/modal.vue @@ -69,5 +69,13 @@ function openModal() { + + + + + + + + diff --git a/playground/app/pages/components/slideover.vue b/playground/app/pages/components/slideover.vue index c14e196c50..c10326a0b8 100644 --- a/playground/app/pages/components/slideover.vue +++ b/playground/app/pages/components/slideover.vue @@ -125,5 +125,21 @@ function openSlideover() { + + + + + + + + + + + + + + + + diff --git a/src/runtime/components/Modal.vue b/src/runtime/components/Modal.vue index 7108b6012f..b56b5f23b7 100644 --- a/src/runtime/components/Modal.vue +++ b/src/runtime/components/Modal.vue @@ -61,13 +61,13 @@ export interface ModalEmits extends DialogRootEmits { export interface ModalSlots { default(props: { open: boolean }): any - content(props?: {}): any - header(props?: {}): any + content(props: { close: () => void }): any + header(props: { close: () => void }): any title(props?: {}): any description(props?: {}): any - close(props: { ui: { [K in keyof Required]: (props?: Record) => string } }): any - body(props?: {}): any - footer(props?: {}): any + close(props: { close: () => void, ui: { [K in keyof Required]: (props?: Record) => string } }): any + body(props: { close: () => void }): any + footer(props: { close: () => void }): any } @@ -124,8 +124,9 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.modal || {}) })) + - + @@ -148,9 +149,9 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.modal || {}) - - - + + + @@ -165,16 +166,16 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.modal || {}) - - + + @@ -183,11 +184,11 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.modal || {}) - + - + diff --git a/src/runtime/components/Slideover.vue b/src/runtime/components/Slideover.vue index 782a001e8d..6eff0b7673 100644 --- a/src/runtime/components/Slideover.vue +++ b/src/runtime/components/Slideover.vue @@ -61,13 +61,13 @@ export interface SlideoverEmits extends DialogRootEmits { export interface SlideoverSlots { default(props: { open: boolean }): any - content(props?: {}): any - header(props?: {}): any + content(props: { close: () => void }): any + header(props: { close: () => void }): any title(props?: {}): any description(props?: {}): any - close(props: { ui: { [K in keyof Required]: (props?: Record) => string } }): any - body(props?: {}): any - footer(props?: {}): any + close(props: { close: () => void, ui: { [K in keyof Required]: (props?: Record) => string } }): any + body(props: { close: () => void }): any + footer(props: { close: () => void }): any } @@ -124,8 +124,9 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.slideover || })) + - + @@ -155,9 +156,9 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.slideover || - - - + + + @@ -172,16 +173,16 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.slideover || - - + + @@ -190,11 +191,11 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.slideover || - + - +