timolins / react-hot-toast

Smoking Hot React Notifications 🔥
https://react-hot-toast.com
MIT License
9.73k stars 323 forks source link

Custom / Position #316

Open mweel1 opened 11 months ago

mweel1 commented 11 months ago

Is this supposed to work?

The position isn't taking.

const success = (message: string) => {
    toast.custom((t) => {
      t.position = "bottom-center";
      return (
        <Toast type="success">
          <>{message}</>
        </Toast>
      );
    });
  };

It doesn't seem to.

timolins commented 11 months ago

No, this won't work.

You can pass the position as second argument.

toast.custom("Custom", {
  position: "bottom-center"
})

If you are trying to render custom content inside a success toast, there is no need for toast.custom(). You could do this:

toast.success(<h1>Custom Content</h1>, {
  position: "bottom-center"
})