From e5d125df16c306f90980a4a336d17444d1232697 Mon Sep 17 00:00:00 2001 From: Mohit Jain Date: Sat, 1 Aug 2026 16:30:46 +0530 Subject: [PATCH 1/2] feat: added prepend prop for priority toast --- playground/src/components/App.tsx | 33 ++++++++++++++++++- src/core/containerObserver.ts | 20 ++++++++++-- src/core/toast.cy.tsx | 54 +++++++++++++++++++++++++++++++ src/types.ts | 7 ++++ 4 files changed, 110 insertions(+), 4 deletions(-) diff --git a/playground/src/components/App.tsx b/playground/src/components/App.tsx index acde3d51..b2c8141c 100644 --- a/playground/src/components/App.tsx +++ b/playground/src/components/App.tsx @@ -30,7 +30,7 @@ class App extends React.Component { ...defaultProps, transition: 'bounce', type: 'default', - progress: '', + progress: 0, disableAutoClose: false, limit: 0, theme: 'light' @@ -71,6 +71,22 @@ class App extends React.Component { updateToast = () => toast.update(this.toastId, { progress: this.state.progress }); + showPriorityToast = () => { + toast('🥇 Priority toast! (prepend: true)', { prepend: true }); + }; + + firePrependQueueDemo = () => { + toast.dismiss({ containerId: 'prepend-demo' }); + toast.clearWaitingQueue({ containerId: 'prepend-demo' }); + toast('Queued 1', { containerId: 'prepend-demo' }); + toast('Queued 2', { containerId: 'prepend-demo' }); + toast('Queued 3', { containerId: 'prepend-demo' }); + toast('🥇 Priority toast, skips the queue!', { + containerId: 'prepend-demo', + prepend: true + }); + }; + handleAutoCloseDelay = e => this.setState({ autoClose: e.target.value > 0 ? parseInt(e.target.value, 10) : 1 @@ -219,6 +235,14 @@ class App extends React.Component { Show Toast +
  • + +