Questions About Toast Placement and Meta Properties #3073
-
I encountered two issues while using the 1. Placement BehaviorAccording to the For example, consider the following use case:
If I understand correctly, this would require two separate global 2. Meta Properties CustomizationIf I understand correctly, the If we could extend it like this, it would be great: declare module '@ark-ui/react/toast' {
interface ToastMeta {
bgColored?: boolean;
showIcon?: boolean;
showClose?: boolean;
showProgress?: boolean;
}
} Currently, I find myself repeatedly using primaryToaster.update(toastId.current, {
title: t(`serverCodes.${SignInFormReturnCode.SIGN_IN_SUCCESS}`),
type: 'success',
meta: { showProgress: false } satisfies ToastMeta,
}); This adds a lot of boilerplate. Could this be simplified by providing a more extensible I’d appreciate any guidance or clarification on these points. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for reaching out! For your first question—yes, your assumption is correct. You need to create a Toaster for each position. The challenge lies not only in the design but also in avoiding cluttering the DOM with separate render nodes for each position. We also factored in typical usage patterns, as most apps render toasts in a single position for a more consistent user experience. As for your second question—I’ve encountered this myself. The best solution is to use a generic to properly type your metadata. However, since this isn’t currently planned, your workaround should be fine for now. |
Beta Was this translation helpful? Give feedback.
@carlosyan1807
Thanks for reaching out!
For your first question—yes, your assumption is correct. You need to create a Toaster for each position. The challenge lies not only in the design but also in avoiding cluttering the DOM with separate render nodes for each position. We also factored in typical usage patterns, as most apps render toasts in a single position for a more consistent user experience.
As for your second question—I’ve encountered this myself. The best solution is to use a generic to properly type your metadata. However, since this isn’t currently planned, your workaround should be fine for now.