Toast isn't displaying the proper style - Next.js

I am currently implementing the react-toastify library.

Within my _app.tsx file:


import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';

...

  return (
    <AppStateProvider>
      <MainProvider>
      <HeaderProvider>
        <Component {...pageProps} />
        <ToastContainer
          position="top-right"
          autoClose={5000}
          hideProgressBar={false}
          newestOnTop={false}
          closeOnClick
          rtl={true}
          pauseOnFocusLoss
          draggable
          pauseOnHover
        />
       </HeaderProvider>
       </MainProvider>
    </AppStateProvider>
  );
}

When using the library in my component:

toast.success("success")

However, in my implementation it displays like this:

https://i.sstatic.net/P3g4I.png

Contrastingly, the demo shows:

https://i.sstatic.net/31w26.png

Answer №1

Just sharing my experience with React-Toastify on SO! Encountered a similar situation while experimenting with it.

The key is to specify the theme for your toast messages.

For example:

toast.success("success", {
  theme: "colored"
})

If you want a colored theme, use "colored".

toast.success("success", {
  theme: "dark"
})

You can also opt for a "dark" theme.

If no theme is provided, the default appearance will be like the image attached in your question.

Answer №2

Take out the rtl={true} from the ToastContainer component;

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Invoking a C function from the server side using an HTML button's callback function

I'm interested in implementing a way to trigger a C/C++ function after clicking a button on a website. Imagine having a website that includes an image and a button; upon clicking the button, I want to execute a C routine that applies some sort of filt ...

Connect event handler to the document to fetch data from the firebase API using the useEffect hook

Simple Explanation: My main objective is to achieve something similar to the example link provided, but with an asynchronous call to Firebase for each useEffect where the list content is populated by Firebase objects. https://codesandbox.io/s/usage-pxfy7 ...

Is it necessary to store tokens in cookies, local storage, or sessions?

I am currently utilizing React SPA, Express, Express-session, Passport, and JWT. I find myself puzzled by the various client-side storage options available for storing tokens: Cookies, Session, and JWT/Passport. Is it necessary to store tokens in cookies, ...

Ending a connection to MS SQL server in node.js with mssql library

In my journey to write a node.js script for querying an MSSQL database, I find myself navigating the realm of JavaScript, node.js, and VSCode with limited SQL knowledge. While I have managed to piece together working code, the issue lies in the connection ...

Invoke a C# server-side function from Javascript while passing parameters

Despite searching for an answer to this question, I have yet to find a solution that works for me. My ASP web page contains multiple buttons with different functions, as well as a dropdown box filled with objects. When I select an item from the dropdown, ...

Develop a selection tool based on certain column information - utilizing JavaScript

I'm currently working on a table with a large amount of data, and I'd like to implement a select option for filtering. While I have successfully added the filter with the select element, my concern is how to dynamically populate the options witho ...

The blur feature in Tinymce isn't functioning properly when handling multiple editable textareas simultaneously

I am experiencing an issue with the Tinymce blur function not working correctly. I have multiple elements where Tinymce editor is being used. I am utilizing the dblclick event to edit a textarea, and everything works fine except for the blur event not trig ...

What is the best way to utilize Javascript in order to alter the background of an HTML table?

Seeking Help with HTML Table I have an HTML table with numbers where the sum of the first and second column should equal the third column. Some sums are incorrect, and I need to use JavaScript to change the background color of rows with wrong answers and s ...

"The NextJS FetchError that occurred was due to a timeout issue (ET

After successfully deploying my project on CentOS 7, I set up port forwarding to access it through port 8080. This means that in order to use the site, you had to navigate to it using the IP followed by :8080. Below is the NGINX configuration I utilized fo ...

Axios: Actions taken by users prior to logging in

After successfully sending "EnvioLogin" with the correct email/password, I am able to obtain the access token from "/login", but I encounter an issue when trying to access "/users" after that. Upon inspecting in my browser, I found these image links: https ...

Fixed header and scrollable table with both horizontal and vertical movement

My calendar has a list of users on the left side and dates with cells on the right side. I need to ensure that the dates stay fixed at the top when scrolling to the bottom of the page. However, this is proving tricky because my main table containing the da ...

Keep your HTML columns and tables up to date with the latest changes in your database by harnessing the power of Ajax

As a newcomer to using Ajax and javascript, I have an HTML page that displays the shopping status of customers. I am looking to incorporate Ajax and jquery functionality to update the database and refresh the webpage without actually reloading it whenever ...

Tips for utilizing the JQuery feature to clear input text

After attempting to use onfocus and onblur attributes within the input tag to clear input text, I discovered a JQuery function that should do the trick for me. However, I am encountering issues with getting it to work across multiple fields. $('.defa ...

Using the underscore template to dynamically assign images

Currently, I am utilizing underscore templates to showcase a HTML list demonstrating a series of contact details. The format of the template is as follows: <li> <span class="name">Name: <=%data.name%></span> <span class="emai ...

Tips for resolving the <!--bindings={ "ng-reflect-ng-for-of": "" }--> bug

Just starting out with Angular and I am having some issues with event binding and property binding in my game-control component. I have a button that, when clicked, adds numbers to an array using setInterval method. I am also passing data between compone ...

The datatables button triggers an event twice

Whenever I click a button or tag in datatables, the modal opens twice and ajax runs twice. PS. I am using angular.js with datatables as a directive that is created by jQuery datatables, not the Angular datatables module. How can I solve this issue? Than ...

Flatpickr will refresh the list of days once a day is selected, causing any modifications made using onDayCreate to be reverted

After creating a Vue.js component that displays a customized calendar with different background colors for days, I encountered a problem. Whenever I select a day, all my customizations are lost because Flatpickr redraws the DOM elements for the days. How c ...

Transferring the state from a parent component to a child function

I'm having trouble passing a state from a component to a function. I was able to pass the state from Home to ListHome, but I'm struggling to continue passing it to a function within ListHome (Slider) because it's a function. Even after revi ...

Having trouble transforming the JSON object into a usable format

Although I'm still getting the hang of JSON, please bear with me if this seems like a rookie mistake. My approach involves sending a query to a local file that performs a cURL operation on an external site's API and returns a JSON object. Due to ...

Verify using JavaScript whether the call is originating from a specific JSP

My global.js file serves as a common JavaScript file across my project. I recently added some code to a function named 'test' in this file. However, I only want this code to run when the function is called from a specific JSP file called home.j ...