diff --git a/docs/app.vue b/docs/app.vue index da5b1e4d5f..ac5d709473 100644 --- a/docs/app.vue +++ b/docs/app.vue @@ -38,7 +38,15 @@ - + + + + + diff --git a/docs/components/content/examples/NotificationExampleHtml.vue b/docs/components/content/examples/NotificationExampleHtml.vue new file mode 100644 index 0000000000..3ebfe1864f --- /dev/null +++ b/docs/components/content/examples/NotificationExampleHtml.vue @@ -0,0 +1,7 @@ + + + diff --git a/docs/content/6.overlays/6.notification.md b/docs/content/6.overlays/6.notification.md index d2d1eecad8..63d7dfec55 100644 --- a/docs/content/6.overlays/6.notification.md +++ b/docs/content/6.overlays/6.notification.md @@ -316,6 +316,50 @@ excludedProps: --- :: +## Slots + +### `title` / `description` + +Use the `#title` and `#description` slots to customize the Notification. + +This can be handy when you want to display HTML content. To achieve this, you can define those slots in the top-level `` component in your `app.vue` and use the `v-html` directive. + +```vue [app.vue] + +``` + +This way, you can use HTML tags in the `title` and `description` props when using `useToast`. + +::component-example +#default +:notification-example-html + +#code +```vue + + + +``` +:: + +::callout{icon="i-heroicons-light-bulb"} +Slots defined in the `` component are automatically passed down to the `Notification` children. +:: + ## Props :component-props diff --git a/src/runtime/components/overlays/Notification.vue b/src/runtime/components/overlays/Notification.vue index 2e827e0604..aa0a56e26b 100644 --- a/src/runtime/components/overlays/Notification.vue +++ b/src/runtime/components/overlays/Notification.vue @@ -9,10 +9,14 @@

- {{ title }} + + {{ title }} +

- {{ description }} + + {{ description }} +

diff --git a/src/runtime/components/overlays/Notifications.vue b/src/runtime/components/overlays/Notifications.vue index f903ba09ed..b38c5a89c7 100644 --- a/src/runtime/components/overlays/Notifications.vue +++ b/src/runtime/components/overlays/Notifications.vue @@ -7,7 +7,11 @@ :class="notification.click && 'cursor-pointer'" @click="notification.click && notification.click(notification)" @close="toast.remove(notification.id)" - /> + > + +