Skip to main content
NeuralUIv1.14.3New
GitHub
Component

Toast

Floating notifications launched from NeuToastService. Supports 4 semantic types and 4 configurable screen positions.

TypeScript
import { NeuToastComponent, NeuToastService } from '@neural-ui/core/toast';
TypeScript
import { NeuToastService, NeuToastContainerComponent } from '@neural-ui/core/toast';

// 1. Add the container in app.html once
// <neu-toast-container />

// 2. Inject and use it in any component
@Component({ ... })
export class MyComponent {
  private toast = inject(NeuToastService);

  // Change position globally for all toasts
  this.toast.setPosition('bottom-right');

  save(): void {
    this.toast.success('Saved successfully', { title: 'Success' });
  }

  handleError(): void {
    this.toast.error('An error occurred', { title: 'Error', duration: 8000 });
  }
}