sonner-next-intl
createUseTranslatedToast
Utility that creates a typed React hook to produce translated Sonner toasts
using a next-intl translator instance and the sonner API exposed by the
useConfig hook.
The hook returned by createUseTranslatedToast is generic over your project’s
message shape (M). It returns a useTranslatedToast hook that optionally can
be scoped to a namespace (N). The useTranslatedToast hook exposes a toast
object with the same API as sonner but accepting TranslatedMessage typed
objects (message keys, data and formats) instead of raw strings.
JSDoc is intentionally descriptive so consumers of the library can read parameter and return types in editors and generate documentation.
Interfaces
Section titled “Interfaces”Type Aliases
Section titled “Type Aliases”- ConfigOptions
- LocalMessages
- PromiseData
- PromiseExternalToast
- PromiseT
- PromiseTExtendedResult
- SubMessages
- TranslatedExternalToast
- TranslatedMessage
- TranslatedToast