shadcn.io is an independent project built on shadcn/ui
Show Toast is an outline button. The notice asks if you want to continue, and it has Cancel. Cancel closes it and shows an info toast, Action cancelled. A swipe does not run Cancel.
Use it when no is the only extra choice. A real confirm, with both answers required, is an Alert Dialog. In React, Base UI does not treat a swipe as that button.
Installation
Anatomy

Usage
<>
<Toaster />
<Button onClick={handleShowToast} variant="outline">
Show Toast
</Button>
</>FAQ
How is the Cancel button set?
The title is "Are you sure you want to continue?". cancel is { label: "Cancel", onClick: () => toast.info("Action cancelled") }. The label is the button text.
What happens when Cancel is clicked?
onClick runs and the toast closes. dismissible is not set, so the button is active. An info toast then shows "Action cancelled".
How do I add a confirm button next to it?
Pass action with a label and an onClick. This file passes cancel only, so there is one button.
Does a swipe do the same thing as Cancel?
A swipe closes the toast and does not run onClick. Cancel runs toast.info and then closes. This call does not pass dismissible.
API Reference
Sonner
No extra props in this demo. The rest is on the Sonner page.
Button
Sets onClick={handleShowToast} and variant="outline". The rest is on the Button page.




