Veil UI
Components

Toaster

Alias entry for the Toast provider, hook and viewport.

Installation

$ npx veil-ui@latest add toaster

Usage

import { Toaster, ToastProvider, useToast } from "@/components/ui/toaster";

<ToastProvider>
  <App />
  <Toaster />
</ToastProvider>;

Examples

Basic

    Variants

      API reference

      Toaster, ToastProvider, useToast and toastVariants re-export the Toast API.

      Accessibility

      • Announcements, dismissal and focus pausing are inherited from Toast.

      Vue and plain HTML

      This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add toaster --framework vue or switch the framework in components.json.

      <script setup lang="ts">
      import { Toaster as ToastViewport } from "@/components/ui/toast";
      import { cn } from "@/lib/utils";
      
      const props = defineProps<{ class?: string }>();
      </script>
      
      <template>
        <ToastViewport :class="cn('sm:max-w-sm', props.class)" />
      </template>
      

      On this page