diff --git a/docs/app/components/content/examples/toast/ToastProgressExample.vue b/docs/app/components/content/examples/toast/ToastProgressExample.vue
new file mode 100644
index 00000000..2fb8ad55
--- /dev/null
+++ b/docs/app/components/content/examples/toast/ToastProgressExample.vue
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/docs/content/3.components/toast.md b/docs/content/3.components/toast.md
index 08ad679d..40eb2be9 100644
--- a/docs/content/3.components/toast.md
+++ b/docs/content/3.components/toast.md
@@ -107,7 +107,7 @@ name: 'toast-color-example'
### Close
-Pass a `close` field to customize or hide the close button (with `false` value).
+Pass a `close` field to customize or hide the close [Button](/components/button) (with `false` value).
::component-example
---
@@ -143,7 +143,7 @@ You can customize this icon globally in your `vite.config.ts` under `ui.icons.cl
### Actions
-Pass an `actions` field to add some [Button](/components/button) actions to the Alert.
+Pass an `actions` field to add some [Button](/components/button) actions to the Toast.
::component-example
---
@@ -155,9 +155,23 @@ name: 'toast-actions-example'
---
::
+### Progress :badge{label="Soon" class="align-text-top"}
+
+Pass a `progress` field to customize or hide the [Progress](/components/progress) bar (with `false` value).
+
+::tip
+The Progress bar inherits the Toast color by default, but you can override it using the `progress.color` field.
+::
+
+::component-example
+---
+name: 'toast-progress-example'
+---
+::
+
### Orientation
-Use the `orientation` prop to change the orientation of the Toast.
+Pass an `orientation` field to the `toast.add` method to change the orientation of the Toast.
::component-example
---
diff --git a/src/runtime/components/Toast.vue b/src/runtime/components/Toast.vue
index 415a056b..14d22d54 100644
--- a/src/runtime/components/Toast.vue
+++ b/src/runtime/components/Toast.vue
@@ -2,7 +2,7 @@
import type { ToastRootProps, ToastRootEmits } from 'reka-ui'
import type { AppConfig } from '@nuxt/schema'
import theme from '#build/ui/toast'
-import type { AvatarProps, ButtonProps } from '../types'
+import type { AvatarProps, ButtonProps, ProgressProps } from '../types'
import type { StringOrVNode, ComponentConfig } from '../types/utils'
type Toast = ComponentConfig
@@ -29,18 +29,6 @@ export interface ToastProps extends Pick
class?: any
ui?: Toast['slots']
}
@@ -78,10 +79,11 @@ import { tv } from '../utils/tv'
import UIcon from './Icon.vue'
import UAvatar from './Avatar.vue'
import UButton from './Button.vue'
+import UProgress from './Progress.vue'
const props = withDefaults(defineProps(), {
- close: true,
orientation: 'vertical',
+ close: true,
progress: true
})
const emits = defineEmits()
@@ -184,6 +186,13 @@ defineExpose({
-
+
diff --git a/src/theme/toast.ts b/src/theme/toast.ts
index edc5740d..bd45a651 100644
--- a/src/theme/toast.ts
+++ b/src/theme/toast.ts
@@ -10,20 +10,18 @@ export default (options: Required) => ({
avatar: 'shrink-0',
avatarSize: '2xl',
actions: 'flex gap-1.5 shrink-0',
- progress: 'absolute inset-x-0 bottom-0 h-1 z-[-1]',
+ progress: 'absolute inset-x-0 bottom-0',
close: 'p-0'
},
variants: {
color: {
...Object.fromEntries((options.theme.colors || []).map((color: string) => [color, {
root: `focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-${color}`,
- icon: `text-${color}`,
- progress: `bg-${color}`
+ icon: `text-${color}`
}])),
neutral: {
root: 'focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-inverted',
- icon: 'text-highlighted',
- progress: 'bg-inverted'
+ icon: 'text-highlighted'
}
},
orientation: {
diff --git a/test/components/__snapshots__/Toast-vue.spec.ts.snap b/test/components/__snapshots__/Toast-vue.spec.ts.snap
index dc5866a7..f104a3f2 100644
--- a/test/components/__snapshots__/Toast-vue.spec.ts.snap
+++ b/test/components/__snapshots__/Toast-vue.spec.ts.snap
@@ -25,7 +25,13 @@ exports[`Toast > renders with actions correctly 1`] = `
-
+
@@ -56,7 +62,13 @@ exports[`Toast > renders with as correctly 1`] = `
-
+
@@ -86,7 +98,13 @@ exports[`Toast > renders with avatar correctly 1`] = `
-
+
@@ -117,7 +135,13 @@ exports[`Toast > renders with class correctly 1`] = `
-
+
@@ -145,7 +169,13 @@ exports[`Toast > renders with close slot correctly 1`] = `
Close slot
-
+
@@ -176,7 +206,13 @@ exports[`Toast > renders with closeIcon correctly 1`] = `
-
+
@@ -207,7 +243,13 @@ exports[`Toast > renders with color neutral correctly 1`] = `
-
+
@@ -238,7 +280,13 @@ exports[`Toast > renders with description correctly 1`] = `
-
+
@@ -269,7 +317,13 @@ exports[`Toast > renders with description slot correctly 1`] = `
-
+
@@ -299,7 +353,13 @@ exports[`Toast > renders with icon correctly 1`] = `
-
+
@@ -328,7 +388,13 @@ exports[`Toast > renders with leading slot correctly 1`] = `
-
+
@@ -359,7 +425,13 @@ exports[`Toast > renders with orientation horizontal correctly 1`] = `
-
+
@@ -392,7 +464,13 @@ exports[`Toast > renders with orientation vertical correctly 1`] = `
-
+
@@ -423,7 +501,13 @@ exports[`Toast > renders with title correctly 1`] = `
-
+
@@ -454,7 +538,13 @@ exports[`Toast > renders with title slot correctly 1`] = `
-
+
@@ -485,7 +575,13 @@ exports[`Toast > renders with type correctly 1`] = `
-
+
@@ -516,7 +612,13 @@ exports[`Toast > renders with ui correctly 1`] = `
-
+
@@ -542,7 +644,13 @@ exports[`Toast > renders without close correctly 1`] = `
-
+
diff --git a/test/components/__snapshots__/Toast.spec.ts.snap b/test/components/__snapshots__/Toast.spec.ts.snap
index c2486688..441183c1 100644
--- a/test/components/__snapshots__/Toast.spec.ts.snap
+++ b/test/components/__snapshots__/Toast.spec.ts.snap
@@ -25,7 +25,13 @@ exports[`Toast > renders with actions correctly 1`] = `
-
+
@@ -56,7 +62,13 @@ exports[`Toast > renders with as correctly 1`] = `
-
+
@@ -86,7 +98,13 @@ exports[`Toast > renders with avatar correctly 1`] = `
-
+
@@ -117,7 +135,13 @@ exports[`Toast > renders with class correctly 1`] = `
-
+
@@ -145,7 +169,13 @@ exports[`Toast > renders with close slot correctly 1`] = `
Close slot
-
+
@@ -176,7 +206,13 @@ exports[`Toast > renders with closeIcon correctly 1`] = `
-
+
@@ -207,7 +243,13 @@ exports[`Toast > renders with color neutral correctly 1`] = `
-
+
@@ -238,7 +280,13 @@ exports[`Toast > renders with description correctly 1`] = `
-
+
@@ -269,7 +317,13 @@ exports[`Toast > renders with description slot correctly 1`] = `
-
+
@@ -299,7 +353,13 @@ exports[`Toast > renders with icon correctly 1`] = `
-
+
@@ -328,7 +388,13 @@ exports[`Toast > renders with leading slot correctly 1`] = `
-
+
@@ -359,7 +425,13 @@ exports[`Toast > renders with orientation horizontal correctly 1`] = `
-
+
@@ -392,7 +464,13 @@ exports[`Toast > renders with orientation vertical correctly 1`] = `
-
+
@@ -423,7 +501,13 @@ exports[`Toast > renders with title correctly 1`] = `
-
+
@@ -454,7 +538,13 @@ exports[`Toast > renders with title slot correctly 1`] = `
-
+
@@ -485,7 +575,13 @@ exports[`Toast > renders with type correctly 1`] = `
-
+
@@ -516,7 +612,13 @@ exports[`Toast > renders with ui correctly 1`] = `
-
+
@@ -542,7 +644,13 @@ exports[`Toast > renders without close correctly 1`] = `
-
+