You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Toaster component is not displaying on the screen when triggered. Despite following the setup instructions and ensuring the component is correctly imported and used, the toast notifications do not appear.
Affected component/components
Toast
How to reproduce
Screen.Recording.2024-10-08.at.2.59.10.AM.mov
Bug description:
The Toaster component, part of the shadcn/ui library, is not rendering on the page as expected. This issue persists despite using the recommended setup and usage patterns.
Set up a Next.js project and import the Toaster component from shadcn/ui.
Add the Toaster component to a page and trigger it via a user action (e.g., clicking a button).
Observe that no toast notification appears on the screen.
import{Button}from"@/components/ui/button";importHeadfrom"next/head";import{toast}from"@/components/hooks/use-toast";import{ToastAction}from"@/components/ui/toast";constTestPage=()=>{return(<><Head><title>Test Page</title><metaname="description"content="This is a test page"/></Head><mainclassName="flex flex-col items-center justify-center h-screen"><h1className="text-6xl font-bold">Test Page</h1><Buttonvariant="outline"onClick={()=>{toast({title: "Scheduled: Catch up ",description: "Friday, February 10, 2023 at 5:57 PM",action: (<ToastActionaltText="Goto schedule to undo">Undo</ToastAction>),})}}>
Add to calendar
</Button></main></>)}exportdefaultTestPage;
layout.tsx
importtype{Metadata}from"next";importlocalFontfrom"next/font/local";import"./globals.css";import{Open_Sans}from'next/font/google';import{Toaster}from"@/components/ui/toaster";interfaceRootLayoutProps{children: React.ReactNode;}// export default async function RootLayout({// children,// }: Readonly<{// children: React.ReactNode;// }>) {exportdefaultfunctionRootLayout({ children }: RootLayoutProps){return(<htmllang="en"><bodyclassName={`${geistSans.variable}${geistMono.variable}${geistOpenSans.variable}${geistGilroy.variable} antialiased`}>{children}<Toaster/></body></html>);}
Codesandbox/StackBlitz link
No response
Logs
No errors output.
System Info
macOS 15.0.1 (24A348)
React Version 18.3.1
Next.js Version 14.2.14
Before submitting
I've made research efforts and searched the documentation
I've searched for existing issues
The text was updated successfully, but these errors were encountered:
Describe the bug
The Toaster component is not displaying on the screen when triggered. Despite following the setup instructions and ensuring the component is correctly imported and used, the toast notifications do not appear.
Affected component/components
Toast
How to reproduce
Screen.Recording.2024-10-08.at.2.59.10.AM.mov
Bug description:
The Toaster component, part of the shadcn/ui library, is not rendering on the page as expected. This issue persists despite using the recommended setup and usage patterns.
Set up a Next.js project and import the Toaster component from shadcn/ui.
Add the Toaster component to a page and trigger it via a user action (e.g., clicking a button).
Observe that no toast notification appears on the screen.
layout.tsx
Codesandbox/StackBlitz link
No response
Logs
System Info
Before submitting
The text was updated successfully, but these errors were encountered: