Module Configuration
Configure Nuxt Notify globally in your nuxt.config.ts to set default behavior for all toasts.
Configuration
Add the notify key to your Nuxt config:
Configuration Options
position
Type: 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center'
Default: 'top-right'
Default position for all toasts.
Can be overridden: Each toast can specify its own position using the position option.
duration
Type: number
Default: 5000
Default duration in milliseconds for all toasts.
Common values:
- Quick messages:
3000(3 seconds) - Standard:
5000(5 seconds) - Important:
10000(10 seconds) - Persistent:
Infinity(never auto-dismiss) ::
maxToasts
Type: number
Default: 5
Maximum number of toasts visible at once. When this limit is reached, the oldest toast is removed when a new one appears.
Setting this too high may clutter the UI. A value between 3-5 is recommended for most applications.
theme
Type: 'light' | 'dark' | 'system'
Default: 'light'
Default color theme for toasts.
Theme Options:
light: Light theme with dark textdark: Dark theme with light textsystem: Automatically matches user's system preference
showIcon
Type: boolean
Default: true
Whether to show icons in toasts by default.
When showIcon is true, you must have @nuxt/icon installed. If set to false, the icon module is optional.
showProgress
Type: boolean
Default: false
Whether to show progress bars on toasts by default.
Complete Configuration Example
Here's a complete configuration with all options:
Overriding Global Config
All global configuration options can be overridden per toast:
Configuration by Environment
You can set different configurations for different environments:
Theme Configuration
Light Theme
Best for applications with predominantly light color schemes.
Dark Theme
Best for applications with dark interfaces or when targeting users who prefer dark mode.
System Theme
Automatically adapts to the user's system preference (light/dark mode). This is the most user-friendly option as it respects user preferences.
Recommended: Use theme: 'system' to provide the best experience for all users, regardless of their preference.
Tailwind v4 Dark Mode
If you're using Tailwind v4 and experiencing dark mode issues, add this to your CSS:
TypeScript Support
Nuxt Notify is fully typed. Your configuration will have full autocomplete and type checking:
Validation
Invalid configuration values will be caught during build:
Best Practices
Position
- Top positions: Better for critical notifications that need immediate attention
- Bottom positions: Less intrusive, good for background processes
- Center positions: Best for important announcements
Duration
- Short (2-3s): Simple confirmations
- Medium (5-7s): Standard notifications with descriptions
- Long (10s+): Important messages with actions
- Infinite: Messages requiring user action
Max Toasts
- 3-5: Recommended for most apps
- 1: For critical notifications only
- 10+: May overwhelm users
Theme
- Use
systemfor best user experience - Match your app's theme if you have a fixed color scheme
Tip: Start with the defaults and adjust based on user feedback and your app's specific needs.
