Skip to content

feat: add prepend(priority) support for toast notifications - #1293

Open
jainmohit535 wants to merge 2 commits into
fkhadra:mainfrom
jainmohit535:feature/priority-toast-1242
Open

feat: add prepend(priority) support for toast notifications#1293
jainmohit535 wants to merge 2 commits into
fkhadra:mainfrom
jainmohit535:feature/priority-toast-1242

Conversation

@jainmohit535

Copy link
Copy Markdown

Closes #1242

Adds a per-toast prepend option that inserts a toast before the ones already displayed (or ahead of the waiting queue when limit is set), instead of always appending it.

  • containerObserver.ts: reorders the active-toasts map on creation when prepend is set; queue.unshift() instead of push() for the limit/queue case.
  • Guarded to only fire for new toasts, not updates — toast.update() merges the original creation options back in, so prepend would otherwise silently persist and incorrectly re-pin an already-placed toast to the front on every update. Covered by a regression test.
  • types.ts: added prepend?: boolean to ToastOptions.
  • Tests: ordering with prepend, empty-list prepend, prepend vs. limit/queue, and the update-doesn't-repin regression.
  • Playground: added a "Priority Toast" button and a dedicated limited-container demo to try it live via pnpm start.

@jainmohit535
jainmohit535 force-pushed the feature/priority-toast-1242 branch 2 times, most recently from 2e2a023 to 308efc9 Compare August 1, 2026 10:17
@jainmohit535
jainmohit535 force-pushed the feature/priority-toast-1242 branch from 308efc9 to cb71d3c Compare August 1, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: show specific toast on top (priority per toast call)

1 participant