# Sonner

> Opinionated toast component with stacking, swipe to dismiss and promise toasts; ports for Vue, Svelte, Solid and Angular.

Source: https://tastebase.ehsanulsiam.workers.dev/browse/sonner

free

Opinionated toast component with stacking, swipe to dismiss and promise toasts; ports for Vue, Svelte, Solid and Angular.

by Emil Kowalski[GitHub](https://github.com/emilkowalski/sonner)[npm](https://npmjs.com/package/sonner)

[visit](https://sonner.emilkowal.ski/?utm_source=tastebase&utm_medium=referral&utm_content=detail-page)

[https://sonner.emilkowal.ski](https://sonner.emilkowal.ski/?utm_source=tastebase&utm_medium=referral&utm_content=detail-preview)

## Try these

no preview

### [react-hot-toast](https://tastebase.ehsanulsiam.workers.dev/browse/react-hot-toast)

Lightweight toast library for React with a headless useToaster hook for fully custom UI.

no preview

### [Base UI](https://tastebase.ehsanulsiam.workers.dev/browse/base-ui)

Unstyled, accessible React primitives from the Radix, Floating UI and MUI teams.

no preview

### [shadcn/ui](https://tastebase.ehsanulsiam.workers.dev/browse/shadcn-ui)

Copy-in React components on Tailwind, built on Base UI, Radix or React Aria, plus a registry CLI.

no preview

### [shadcn-vue](https://tastebase.ehsanulsiam.workers.dev/browse/shadcn-vue)

The Vue port of shadcn/ui: copy-in Tailwind components on Reka UI.

## Try it

## Looks that pick it

[Minimalfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/minimal)[Apple-likefirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/apple)[Playfulfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/playful)[Corporate / dashboardfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/corporate)[Claymorphismfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/claymorphism)[Tactile 3Dfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/tactile-3d)[Material Youfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/material-you)[Fluentfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/fluent)[iOS nativefirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/ios-native)[macOS desktopfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/macos-desktop)[Bento gridfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/bento-grid)[Flat designfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/flat-design)[and 18 more](https://tastebase.ehsanulsiam.workers.dev/looks)

## For your agent

##### Install

`npm i sonner`

##### Use it for

- confirming a background action finished away from where it started (Saved, Invite sent)
- an undoable destructive action (Deleted 3 items, Undo)
- progress of an async task the user can walk away from (toast.promise)

##### Skip it when

- form validation errors: show them inline next to the field
- confirming an action at the button the user just pressed: change the button itself (torph Copy -> Copied, a check icon)
- errors the user must act on or might miss: use an inline alert or a dialog; toasts disappear
- every successful click: toasts for trivial actions train users to ignore them
- a progress bar shown inline: use the kit's Progress component

##### What's inside20 free

- Toaster
- toast()
- toast.success
- toast.error
- toast.info
- toast.warning
- toast.loading
- toast.promise
- toast.custom
- toast.dismiss
- Action / Cancel buttons
- Headless
- Updating toasts
- Persisting toasts
- useSonner
- Expand
- Position
- Multiple Toasters
- Dynamic theme
- Styling (unstyled, classNames)

##### Facts

**Frameworks**
react, vue, svelte, solid, angular

**Styling**
css

**Weight**
small

**Accessibility**
ok

**Maturity**
established

**License**
MIT

**Price**
Free

##### Pairs with

[shadcn/ui](https://tastebase.ehsanulsiam.workers.dev/browse/shadcn-ui)[shadcn-vue](https://tastebase.ehsanulsiam.workers.dev/browse/shadcn-vue)[shadcn-svelte](https://tastebase.ehsanulsiam.workers.dev/browse/shadcn-svelte)[Vaul](https://tastebase.ehsanulsiam.workers.dev/browse/vaul)[Torph](https://tastebase.ehsanulsiam.workers.dev/browse/torph)

##### Alternatives

[react-hot-toast](https://tastebase.ehsanulsiam.workers.dev/browse/react-hot-toast)[Base UI](https://tastebase.ehsanulsiam.workers.dev/browse/base-ui)

[Compare Sonner with its alternatives](https://tastebase.ehsanulsiam.workers.dev/alternatives/sonner-alternatives)

```
import { Toaster, toast } from 'sonner'

<Toaster position="bottom-right" />

<button onClick={() => toast('Invite sent', { action: { label: 'Undo', onClick: undoInvite } })}>Invite</button>
```

https://sonner.emilkowal.ski

Loading website

[Visit](https://sonner.emilkowal.ski/?utm_source=tastebase&utm_medium=referral&utm_content=floating-pill)
