Components
Product created
Laptop Pro 15" is now visible in the store.
Couldn't save the product
Check your connection and try again.
Changes saved automatically×3
<template>
<v-row>
<v-col cols="12" md="6">
<BaseToast
type="success"
:title="$t('ui.demo.toast.success')"
:description="$t('ui.demo.toast.successDescription')"
:action-label="$t('ui.demo.toast.view')"
/>
</v-col>
<v-col cols="12" md="6">
<BaseToast
type="error"
:title="$t('ui.demo.toast.error')"
:description="$t('ui.demo.toast.errorDescription')"
:action-label="$t('ui.demo.toast.retry')"
/>
</v-col>
<v-col cols="12" md="6">
<BaseToast type="warning" :title="$t('ui.demo.toast.warning')" />
</v-col>
<v-col cols="12" md="6">
<BaseToast :title="$t('ui.demo.toast.autosaved')" :count="3" />
</v-col>
<v-col cols="12" md="6">
<BaseToast type="loading" :title="$t('ui.demo.toast.saving')" />
</v-col>
<v-col cols="12" md="6">
<BaseToast type="info" :title="$t('ui.demo.toast.info')" :duration="5000" progress paused />
</v-col>
</v-row>
</template>
These buttons show real toasts in the corner of this page.
<template>
<div class="d-flex flex-wrap ga-3">
<BaseButton button-type="primary" @click="toast.success($t('ui.demo.toast.success'))"
>success</BaseButton
>
<BaseButton
@click="
toast.error($t('ui.demo.toast.error'), {
description: $t('ui.demo.toast.errorDescription'),
})
"
>
error
</BaseButton>
<BaseButton
@click="
toast.info($t('ui.demo.toast.info'), {
action: { label: $t('ui.demo.undo'), onClick: undo },
})
"
>
info + action
</BaseButton>
<BaseButton @click="save">promise</BaseButton>
</div>
</template>
<script setup lang="ts">
const { t } = useI18n()
const toast = useToast()
function undo() {
toast.neutral(t('ui.demo.undo'))
}
function save() {
toast.promise(new Promise((resolve) => setTimeout(resolve, 1500)), {
loading: t('ui.demo.toast.saving'),
success: t('ui.demo.toast.success'),
error: t('ui.demo.toast.error'),
})
}
</script>
Props
| | | |
|---|
titlerequired | string | — | The message. |
type | ToastType | "neutral" | success, info, warning, error, neutral or loading. |
description | string | — | A second line. |
action-label | string | — | Adds an action button. |
count | number | 1 | How many identical toasts were merged. |
duration | number | Number.POSITIVE_INFINITY | Milliseconds before it expires. |
progress | boolean | false | Shows the remaining time. |
paused | boolean | false | Pauses the timer (on hover or focus). |
timer-key | string | number | 0 | Restarts the timer when it changes. |
Events
| | |
|---|
@close | — | The close button was pressed. |
@action | — | The action was pressed. |
@expire | — | The time ran out. |