shadcn.io is not affiliated with official shadcn/ui
Sonner examples · Position
Top Left Position Sonner for React
A button that shows a toast in the top-left corner of the screen.
Top-left keeps a notice clear of controls that sit at the bottom or on the right. This toast passes position: "top-left" on the call, so only this toast moves there.
Preview
Installation
FAQ
Where does this toast appear?
The button calls toast("This is a toast", { position: "top-left" }). That places this notice at the top left. Other toasts keep the position set on Toaster.
How do I put every toast in that spot?
Set position="top-left" on Toaster. This demo sets position on the one call, which is how a single notice lands somewhere the others do not.
Does the position change the message?
No. The message is the string "This is a toast". This call passes no description, icon, action, or duration.
What if I leave position off the call?
Omit position and Toaster uses bottom-right. This call passes top-left so only this notice moves. The allowed values are top-left, top-center, top-right, bottom-left, bottom-center, and bottom-right.
Related
- Bottom Right Position SonnerA button that shows a toast in the
- Top Center Position SonnerA button that shows a toast in the top
- Top Right Position SonnerA button that shows a toast in the
- Default Toast SonnerA button that shows a plain toast with
- Info with Title AlertAn info alert with only a title, for a
- Toast with Description SonnerA toast with a title and a second line of