4

Next.js toast error not getting hide.

i am working on next.js first time.i am facing an issue due to which i am getting error message in a toast at bottom left corner. i want to hide that toast. i inspect the element and found the following code:

<div data-nextjs-toast="true" class="nextjs-toast-errors-parent">
   <div data-nextjs-toast-wrapper="true">
      <div class="nextjs-toast-errors">
         <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
            <circle cx="12" cy="12" r="10"></circle>
            <line x1="12" y1="8" x2="12" y2="12"></line>
            <line x1="12" y1="16" x2="12.01" y2="16"></line>
         </svg>
         <span>5 errors</span>
         <button data-nextjs-toast-errors-hide-button="true" class="nextjs-toast-errors-hide-button" type="button" aria-label="Hide Errors">
            <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
               <path d="M18 6L6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
               <path d="M6 6L18 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
            </svg>
         </button>
      </div>
   </div>
</div>

here is the css details corresponding to the above code's

.nextjs-toast-errors-parent {
    cursor: pointer;
    transition: transform 0.2s ease;
}

if i try to add

display:none;

in the above css , then it disappears.

so i come to my vs code and add the following code in my globals.css file

.nextjs-toast-errors-parent {
    cursor: pointer;
    transition: transform 0.2s ease;
    diplay:none;
}

but it does not work. i try to put the !important with display:none but that is also not working. i found a something on the internet that is nextjs-portal


so i implement the following

nextjs-portal {
  display: none;
}

it hides all the errors , not even toast error but also the overlay errors.

how i can resolve this issue , i am unable to figure out why my css code is not working. is there any other way to implement this.

4
  • why do you want to hide it? in dev mode this toast helps you to debug errors Commented May 7, 2024 at 9:29
  • @VladVladov actually this issue is related to hydration errors. which i am unable to solve. so for now i want to hide this. can you tell me how i can do that Commented May 7, 2024 at 9:35
  • Better to concentrate on solving errors than hiding error info - the error will eventually go to production builds Commented May 7, 2024 at 9:40
  • @VladVladov that's the issue , the code is deployed to the server with build , but i still the error is visible Commented May 7, 2024 at 13:06

2 Answers 2

2

Add this to your next.config.ts file:

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
  devIndicators: {
    appIsrStatus: false,
  },
};

export default nextConfig;

Sign up to request clarification or add additional context in comments.

1 Comment

In 2025 a warning appears: devIndicators.appIsrStatus is deprecated and no longer configurable. Please remove it from next.config.ts.
2

In 2025 the right method to hide/remove the Nextjs at the bottom left of your page is :

In next.config.ts:

import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
  /* config options here */
  devIndicators: false, // This is the options that hide/remove the icon
};

export default nextConfig;

I found the solution directly in the settings when clicking on the icon:

show how to hide the Nextjs icon at the bottom left

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.