Global Configuration

Tired of passing the same options to every single toast? Toastex provides a static config method that allows you to set global defaults for your entire application.

Setup

Call Toastex.config() once during your application's initialization phase (e.g., in your root layout, _app.tsx, or main entry point).

typescript
import { Toastex } from 'toastex';

// Set global defaults
Toastex.config({
  theme: 'dark',
  variant: 'swift',
  position: 'bottom-center',
  duration: 8, // 8 seconds
  sound: true
});

Overrides

Global configuration acts as a baseline. You can still override these defaults on a per-toast basis by simply passing the specific option during the method call.

typescript
// Uses the global theme ('dark') but overrides the position
Toastex.success('Profile updated', { position: 'top-right' });