- Accordion new
- ActionSheet new
- Alert new
- Alert Dialog new
- Angle Slider new
- Autocomplete new
- Avatar new
- Badge new
- Breadcrumb new
- Button new
- Button Group new
- Card new
- Carousel new
- Checkbox new
- Clipboard new
- Collapsible new
- Color Picker new
- Date Input new
- Date Picker new
- Dialog new
- DialogCaller new
- Drawer beta
- Editable new
- Empty new
- Field new
- Fieldset new
- File Upload new
- Filters new
- Floating Panel new
- Hover Card new
- Image new
- Image Cropper new
- Input new
- Input Group new
- Json Tree View new
- Kbd new
- Listbox new
- Marquee new
- Menu new
- Number Input new
- Pagination new
- Password Input new
- PhoneField new
- Pin Input new
- Popover new
- Progress Circular new
- Progress Linear new
- Qr Code new
- Radio Group new
- Rating Group new
- Scroll Area new
- ScrollSpy new
- Segment Group new
- Select new
- Separator new
- Sidebar new
- Signature Pad new
- Skeleton new
- Slider new
- Splitter new
- Steps new
- Switch new
- Table new
- Tabs new
- Tags Input new
- Textarea new
- Timeline new
- Timer new
- Toast new
- Toc new
- Toggle new
- Toggle Group new
- Tooltip new
- Tour new
- Tree View new
- Typography new
Toast
Vue toast notifications for brief success, error, and info feedback without blocking the UI.
Installation
Install from the Vuzeno registry:
bunx --bun shadcn-vue@latest add https://vuzeno.com/r/toast.json
npx shadcn-vue@latest add https://vuzeno.com/r/toast.json
yarn dlx shadcn-vue@latest add https://vuzeno.com/r/toast.json
pnpm dlx shadcn-vue@latest add https://vuzeno.com/r/toast.json
Usage
<script setup lang="ts">
import { Toast, createToaster } from "@/components/ui/toast";
import { X } from "@lucide/vue";
const toaster = createToaster({
placement: "bottom-end",
overlap: true,
gap: 16,
});
</script>
<template>
<button @click="toaster.create({ title: 'Hello', type: 'info' })">
Show toast
</button>
<Toast.Toaster v-slot="toast" :toaster="toaster">
<Toast.Root>
<Toast.Title>{{ toast.title }}</Toast.Title>
<Toast.Description>{{ toast.description }}</Toast.Description>
<Toast.CloseTrigger>
<X />
</Toast.CloseTrigger>
</Toast.Root>
</Toast.Toaster>
</template>
Composition
Toast.Toaster
└── Toast.Root
├── Toast.Indicator
├── Toast.Title
├── Toast.Description
├── Toast.ActionTrigger
└── Toast.CloseTrigger
Examples
Types
You can create different types of toasts (success, error, warning, info) with appropriate styling. For example, to create a success toast, you can do:
toaster.success({
title: "Success!",
description: "Your changes have been saved.",
});
Promise
You can use toaster.promise() to automatically handle the different states of an asynchronous operation. It provides options for the success, error, and loading states of the promise and will automatically update the toast when the promise resolves or rejects.
Update
To update a toast, use the toast.update method.
Action
To add an action to a toast, use the toast.action property.
Duration
You can control how long a toast stays visible by setting a custom duration in milliseconds, or use Infinity to keep it visible until manually dismissed.
Max Visible
Set the max prop on the createToaster function to define the maximum number of toasts that can be rendered at any one time. Any extra toasts will be queued and rendered when a toast has been dismissed.
Placement
Configure where toasts appear on the screen using the placement option in createToaster. Options include top-start, top-end, bottom-start, bottom-end, and more.
API
See Ark UI Toast docs for full props and examples.