Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to customise default toast messages #41

Open
tobiasbueschel opened this issue Feb 9, 2021 · 0 comments
Open

Add ability to customise default toast messages #41

tobiasbueschel opened this issue Feb 9, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@tobiasbueschel
Copy link

tobiasbueschel commented Feb 9, 2021

Hi @timolins 👋

I was thinking that the following API would be nice to allow users to default to a certain toast message if none is provided:

// example API
<Toaster types=[{
  icon: ErrorIcon,
  defaultMessage: 'An error happened'
}]

// in this way one could do the following
toast.error()

// An alternative to this would be to wrap the `toast` object and export it in your application, e.g.
import { toast as toastHander } from 'react-hot-toast'

export const toast = {
  ...toastHandler,
  error: (message, opts) => toastHandler.error(message || 'Your default error message', opts)
}

What do you think?

@tobiasbueschel tobiasbueschel changed the title Add ability to customise default messages Add ability to customise default toast messages Feb 9, 2021
@timolins timolins added the enhancement New feature or request label Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants