Toasts
The main container component that renders all active toast notifications. It handles positioning, transitions, and manages the list of toasts.Usage
Features
- Automatic positioning based on plugin configuration
- Smooth enter/exit transitions using Vue’s
TransitionGroup - Responsive design with fixed positioning
- Maximum width constraint (
max-w-sm) - Z-index of 50 for proper layering
Position-based animations
The component dynamically adjusts animations based on position:- Left positions: Slides in from left
- Right positions: Slides in from right
- Center positions: Slides in from top or bottom
- All animations include opacity transitions
This component does not accept any props. All configuration is handled through the plugin options.
ToastItem
Individual toast notification component with icon, message, title, and close button. Automatically handles auto-dismiss based on duration.Props
The toast object to display.
Events
Emitted when the toast should be removed. The parent
Toasts component handles this event to remove the toast from the store.Usage
Slots
Custom icon slot to override the default level-based icon. The slot receives no props.
Level-based styling
Each toast level has distinct colors and icons:- Success
- Error
- Warning
- Info
- Background: Green (bg-green-50, text-green-800)
- Icon: Checkmark circle with green background
- Icon background: bg-green-100, text-green-500
Auto-dismiss behavior
- Duration is determined by
toast.durationor falls back to the global config duration - If duration is
0or negative, auto-dismiss is disabled - Timer starts when the component mounts
- Emits
removeevent when timer expires
Structure
Each toast includes:- Icon container: 8x8 rounded square with level-based background
- Content area:
- Optional title in semibold font
- Message text in normal weight
- Close button: Manual dismiss with hover effects and focus ring
The component uses Tailwind CSS classes and requires Tailwind to be configured in your project.