Breaking change. NToast previously wrapped Reka UI and took a single options object —
toast({ title, description, actions }). It now exposes vue-sonner's API, where the message is the
first argument. See Migrating below.
Setup
Add NToaster once, in your app.vue:
Examples
Basic
useToast() returns vue-sonner's toast. The message is the first argument; everything else is options.
Types
Each type renders its own coloured icon on a neutral card.
toast.loading() never dismisses on its own — resolve it by passing its id to a later call, or call
toast.dismiss(id).
Actions
| Option | Type | Description |
|---|---|---|
action | NToastAction | A single button. |
cancel | NToastAction | A single dismissing button. |
actions | NToastAction[] | Two or more buttons. una's own option — vue-sonner allows only one. |
Buttons are NButton components, so any NButton prop works — btn, size, leading.
They default to outline-gray, and cancel to ghost-gray. A single button sits inline with the
text; two or more move to their own row underneath.
onClick dismisses the toast afterwards. Pass dismissOnClick: false to keep it open.
Promise and updating
toast.promise() follows a promise through its states. Any toast can also be updated in place by
passing its id to a later call — the usual way to resolve a loading toast.
Progress
| Option | Default | Type | Description |
|---|---|---|---|
showProgress | false | boolean | Show a bar counting down duration. |
progress | - | {color} | Colour of the bar. |
vue-sonner exposes no remaining-time hook, so the bar runs its own timer. It pauses whenever vue-sonner pauses dismissal — hovering the stack or hiding the window — so the two stay in step.
Toaster
NToaster accepts every vue-sonner Toaster prop.
| Prop | Default | Type | Description |
|---|---|---|---|
position | bottom-right | Position | Corner the stack sits in. |
duration | 4000 | number | How long a toast stays, in milliseconds. |
visibleToasts | 3 | number | How many are shown before the rest are stacked. |
expand | false | boolean | Show the stack expanded instead of collapsed. |
closeButton | false | boolean | Show a close button on every toast. |
richColors | false | boolean | Tint the card per type, using vue-sonner's palette rather than una's tokens. |
duration, closeButton and richColors can also be set per toast.
Toasts using una-specific options — actions, showProgress, leading or una — render through
una's own component, which vue-sonner treats as fully custom: closeButton and richColors don't
apply to them.
Theming
Colours come from una's theme tokens — the card follows popover, popover-foreground and
border, and type icons follow success, error, warning and info. Dark mode is handled by
una's colour mode; nothing extra is needed.
Individual parts can be restyled through the una prop:
Migrating
| Before | After |
|---|---|
title: 'Saved' | The message is the first argument — toast('Saved'). |
toast: 'soft-error' and other variants | A type call — toast.error(), toast.success(), … |
closable: true | closeButton: true, and it now defaults to false. |
_toastProvider.duration | duration — per toast, or on NToaster for all of them. |
_toastProvider.swipeDirection | swipeDirections on NToaster. |
const { dismiss, update } = toast({ … }) | Keep the returned id — toast.dismiss(id), toast('New title', { id }). |
useToast().toasts | Gone — NToaster renders the stack itself. |
Slots — #title, #description, #actions, … | toast.custom(markRaw(MyToast)) renders a component of your own. |
NToastProvider / Viewport / Title / … | Removed — NToaster is the only component left. |
actions[], showProgress and leading carry over unchanged.