Docs
Sonner

Sonner

An opinionated toast component for Angular.

Loading...
Loading...

About

ngx-sonner is built and maintained by tutkli.

Installation

Run the following command:

npx shadcn-ng@latest add sonner
npm
yarn
pnpm
bun

Add the Toaster component

import { Component } from '@angular/core'
 
import { ToasterComponent } from '@/components/ui/sonner'
 
@Component({
  standalone: true,
  selector: 'app-root',
  imports: [ToasterComponent],
  template: `
    <ub-toaster />
  `,
})
export class AppComponent {}

Install the following dependencies:

npm install ngx-sonner
npm
yarn
pnpm
bun

Copy and paste the following code into your project.

Add the Toaster component

import { Component } from '@angular/core'
 
import { ToasterComponent } from '@/components/ui/sonner'
 
@Component({
  standalone: true,
  selector: 'app-root',
  imports: [ToasterComponent],
  template: `
    <ub-toaster />
  `,
})
export class AppComponent {}

Usage

import { toast } from "ngx-sonner"
toast("Event has been created.")