timolins / react-hot-toast

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

Custom / Position #316

Open mweel1 opened 1 year ago

mweel1 commented 1 year 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 1 year 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"
})