Skip to content

Commit 4949120

Browse files
authored
docs(toast): improve examples for global App settings (#4597)
1 parent 307b4f7 commit 4949120

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

docs/content/3.components/toast.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,26 @@ name: 'toast-orientation-example'
188188

189189
## Examples
190190

191+
::note{to="/components/app"}
192+
Nuxt UI provides an **App** component that wraps your app to provide global configurations.
193+
::
194+
191195
### Change global position
192196

193197
Change the `toaster.position` prop on the [App](/components/app#props) component to change the position of the toasts.
194198

199+
```vue [app.vue]
200+
<script setup lang="ts">
201+
const toaster = { position: 'bottom-right' }
202+
</script>
203+
204+
<template>
205+
<UApp :toaster="toaster">
206+
<NuxtPage />
207+
</UApp>
208+
</template>
209+
```
210+
195211
::component-example
196212
---
197213
prettier: true
@@ -210,6 +226,18 @@ In this example, we use the `AppConfig` to configure the `position` prop of the
210226

211227
Change the `toaster.duration` prop on the [App](/components/app#props) component to change the duration of the toasts.
212228

229+
```vue [app.vue]
230+
<script setup lang="ts">
231+
const toaster = { duration: 5000 }
232+
</script>
233+
234+
<template>
235+
<UApp :toaster="toaster">
236+
<NuxtPage />
237+
</UApp>
238+
</template>
239+
```
240+
213241
::component-example
214242
---
215243
prettier: true
@@ -232,6 +260,18 @@ Set the `toaster.expand` prop to `false` on the [App](/components/app#props) com
232260
You can hover over the toasts to expand them. This will also pause the timer of the toasts.
233261
::
234262

263+
```vue [app.vue]
264+
<script setup lang="ts">
265+
const toaster = { expand: true }
266+
</script>
267+
268+
<template>
269+
<UApp :toaster="toaster">
270+
<NuxtPage />
271+
</UApp>
272+
</template>
273+
```
274+
235275
::component-example
236276
---
237277
prettier: true

0 commit comments

Comments
 (0)