You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/3.components/modal.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -305,13 +305,13 @@ slots:
305
305
306
306
### Programmatic usage
307
307
308
-
You can use the [`useOverlay`](/composables/use-overlay) composable to open a Modal programatically.
308
+
You can use the [`useOverlay`](/composables/use-overlay) composable to open a Modal programmatically.
309
309
310
310
::warning
311
311
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.
312
312
::
313
313
314
-
First, create a modal component that will be opened programatically:
314
+
First, create a modal component that will be opened programmatically:
315
315
316
316
::component-example
317
317
---
@@ -347,6 +347,22 @@ name: 'modal-nested-example'
347
347
---
348
348
::
349
349
350
+
### Using the close method
351
+
352
+
All slots in the Modal component receive a `close` method that can be used to programmatically close the modal from within the content.
353
+
354
+
::component-example
355
+
---
356
+
name: 'modal-programmatic-close'
357
+
props:
358
+
class: 'px-4'
359
+
---
360
+
::
361
+
362
+
::tip
363
+
The `close` method is available in all slots: `content`, `header`, `body`, and `footer`.
364
+
::
365
+
350
366
### With footer slot
351
367
352
368
Use the `#footer` slot to add content after the Modal's body.
Copy file name to clipboardExpand all lines: docs/content/3.components/slideover.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -304,13 +304,13 @@ slots:
304
304
305
305
### Programmatic usage
306
306
307
-
You can use the [`useOverlay`](/composables/use-overlay) composable to open a Slideover programatically.
307
+
You can use the [`useOverlay`](/composables/use-overlay) composable to open a Slideover programmatically.
308
308
309
309
::warning
310
310
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.
311
311
::
312
312
313
-
First, create a slideover component that will be opened programatically:
313
+
First, create a slideover component that will be opened programmatically:
<USlideovertitle="Slideover with scoped slot close"description="This slideover has a scoped slot close that can be used to close the slideover from within the content.">
130
+
<UButtoncolor="neutral"variant="subtle"label="Open with scoped slot close" />
131
+
132
+
<template #header="{ close }">
133
+
<UButtonlabel="Close with scoped slot close"@click="close" />
134
+
</template>
135
+
136
+
<template #body="{ close }">
137
+
<UButtonlabel="Close with scoped slot close"@click="close" />
138
+
</template>
139
+
140
+
<template #footer="{ close }">
141
+
<UButtonlabel="Close with scoped slot close"@click="close" />
0 commit comments