Skip to content

Custom Toast Position #371

Answered by urg0
echosssss asked this question in Q&A
Discussion options

You must be logged in to vote

To entirely customize the position of a toast in React Hot Toast, you can use the style prop to set a specific position. For example:

toast('Your message here', {
  style: {
    top: '10px',
    right: '20px',
  },
});

Alternatively, you can use the toast.custom method to render any custom JSX element, giving you full control over its placement. For example:

toast.custom(
  <div style={{ position: 'fixed', top: '50px', right: '10%' }}>
    Custom Toast Content
  </div>
);

These methods give you flexibility depending on whether you need simple adjustments or a completely custom layout. Both approaches ensure your toast notifications appear exactly where you want them on the screen.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by echosssss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants