Skip to content
Source
Sign inSign up
pingdotgg/t3code

Add close buttons to toasts #2023

Mergednoxire-dev(GitHub profile, opens in a new tab)merged 17 commits intomain fromrefs/pull/2023/headmerged by juliusmarminge View on GitHub

Summary

  • Add a close (X) button to standard and anchored toasts for one-click dismissal
  • Improves accessibility for keyboard/mouse users who can't easily swipe-to-dismiss
  • Uses existing XIcon from lucide-react, styled consistently with CopyErrorButton
  • No changes to existing swipe or auto-dismiss behavior

Test plan

  • Trigger toasts of each type (info, success, warning, error, loading)
  • Verify the X button appears on the right side of each toast
  • Verify clicking X immediately dismisses the toast
  • Verify swipe-to-dismiss still works as before
  • Verify toasts with action buttons show both the action and X button
  • Verify anchored (non-tooltip) toasts also have the X button
  • Verify tooltip-style anchored toasts do NOT have the X button

Note

Medium Risk Touches shared toast rendering/layout logic and updates many callsites, so regressions could impact notification UX across the app (stacking, sizing, dismissal, and actions). No auth/data-handling changes.

Overview Toasts get a UI/behavior refresh focused on dismissal and richer content. Adds a corner X close control to both stacked and anchored toasts, and introduces optional expandable details content (including a description-as-disclosure mode) for warnings/errors.

Toast stacking/animation is adjusted to reduce jank. buildVisibleToastLayout now keeps ending toasts in-place while live toasts reflow forward, and the toast container sizing logic is updated to avoid height/peek glitches.

Callsites are migrated to a new helper. Adds stackedThreadToast() to standardize stacked action layout and updates many error/warning toast usages to use it; the slow-RPC warning toast now includes an expandable per-request details list.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1250b8a8f8cfacf842bbe35369eb143fb7dad2d7. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add close buttons and expandable details to toasts

  • Adds a corner dismiss button to all toasts (both stacked and anchored) via toastManager.close / anchoredToastManager.close.
  • Introduces a ToastExpandableSection component and expandableContent/expandableLabels/expandableDescriptionTrigger fields on ThreadToastData, allowing toasts to show collapsible detail panels (used first for slow RPC request details).
  • Adds a stackedThreadToast helper in toastHelpers.ts that standardizes construction of stacked-layout thread toasts; migrates all error/warning toast callsites across the app to use it.
  • Updates buildVisibleToastLayout in toast.logic.ts so dismissing toasts animates correctly: ending toasts hold their slot while live toasts reflow forward.
  • Long error descriptions are now visually clamped via errorDescriptionClampClass, while the full string is still copied to clipboard.
Macroscope summarized 1250b8a.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: 322f332c-aeb3-4ac2-9cd4-0e651e249c93

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved

      UI enhancement adding close buttons to toasts and refactoring toast calls to use a consistent helper function. The majority of changes are mechanical wrapping of existing toast calls. The open review comment about a dev route does not apply to files changed in this PR.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. screenshots plss

    5. noxire-dev(GitHub profile, opens in a new tab)commented
      Screenshot 2026-04-15 180541 Screenshot 2026-04-15 180552 Screenshot 2026-04-15 180558 Screenshot 2026-04-15 180604 Screenshot 2026-04-15 180608 Screenshot 2026-04-15 180614 Screenshot 2026-04-15 180627

      sorry for the missing screenshots

      the last picture 3 toast at the same time so its not a dup screenshots it just looks like that

    6. i did a more focused version of this fix specifically for the 'slow requests' toast, see pr #2040

    7. Hey can you reference my closed pr #2040 for styling? I think this fits the design language of t3 code a lot better. It looks like your dismiss button is centered vertically which is weird. Below is the way it looks on my closed pr. just incorporate that styling.

      image

      @juliusmarminge @noxire-dev

    8. Hey can you reference my closed pr #2040 for styling? I think this fits the design language of t3 code a lot better. It looks like your dismiss button is centered vertically which is weird. Below is the way it looks on my closed pr. just incorporate that styling.

      image @juliusmarminge @noxire-dev

      yea top-right definitely looks better. should also make sure the "Copy Error" button aligns well

    9. Screenshot 2026-04-16 123142 Screenshot 2026-04-16 123148 Screenshot 2026-04-16 123152 Screenshot 2026-04-16 123157 Screenshot 2026-04-16 123201 Screenshot 2026-04-16 123206 thank you for the feedback, I tweak the styling is this verison better ? if so i can update the branch @juliusmarminge
    10. kendalled(GitHub profile, opens in a new tab)commented
      Screenshot 2026-04-16 123142 Screenshot 2026-04-16 123148 Screenshot 2026-04-16 123152 Screenshot 2026-04-16 123157 Screenshot 2026-04-16 123201 Screenshot 2026-04-16 123206 thank you for the feedback, I tweak the styling is this verison better ? if so i can update the branch @juliusmarminge

      Only thing in my opinion is the copy error button as @juliusmarminge says looks like it's not sized the same as the close button, maybe just because the svg doesn't take up the whole viewbox idk. It definitely looks better though. Just make sure the copy error button and the close button are the same sizing if they are not currently. Good work though! almost perfect

      for reference i got really good styling by telling codex to copy the "refresh provider" button styling in the settings menu. so have it do one last pass to make sure the copy error button and the close button are the same as that because that's the perfect size and used across the app for little buttons like this.

    11. noxire-dev(GitHub profile, opens in a new tab)commented

      Thanks for the nice comments ! Screenshot 2026-04-17 003637

      I tweaked the stuff a bit and moved the copy btn to header place what is your opinons about that ? i can revert it back to original place as well @kendalled @juliusmarminge

    12. i would have both to the right center aligned on the toast title?

    13. image more like this ? sorry this is my first time contributing to open source so if its a bit back and forward @juliusmarminge
    14. also i feel like the action button is a bit too close to the x button image what is your opinons about this style ? in order to stop accidently click on it

    15. image more like this ? sorry this is my first time contributing to open source so if its a bit back and forward @juliusmarminge

      this is good

    16. also i feel like the action button is a bit too close to the x button image what is your opinons about this style ? in order to stop accidently click on it

      eh it looks weird. undo should be next to the x. dont overcomplicate it! you basically have it done, no need to keep fixing

    17. image

      this looks good!

      please post a SS of different toast variatns with differnet states in the final state

    18. kendalled(GitHub profile, opens in a new tab) requested changes

      kendalled(GitHub profile, opens in a new tab)replied on apps/web/src/components/ui/toast.tsx line 317

      @noxire-dev just make sure you addressed this and it's looking good. Don't know if you saw this.

    19. noxire-dev(GitHub profile, opens in a new tab)commented

      @cursoragent i fixed the previous bug and played with the toast stack logic. old version was kinda slow + there was a visual weirdness when promoting the second toast to primary it waited for the top toast's exit anim before reflowing, so you'd see a stop-then-bump. skipping ending toasts from the layout calc fixes both. sending it, wdyt? @juliusmarminge @kendalled

    20. @cursoragent i fixed the previous bug and played with the toast stack logic. old version was kinda slow + there was a visual weirdness when promoting the second toast to primary it waited for the top toast's exit anim before reflowing, so you'd see a stop-then-bump. skipping ending toasts from the layout calc fixes both. sending it, wdyt? @juliusmarminge @kendalled

      can you put video / screen recording of everything working so i dont have to build it while I'm at work to see

    21. noxire-dev(GitHub profile, opens in a new tab)commented

      https://github.com/user-attachments/assets/0db6f3ae-5f76-4a20-8c3c-f889f4b9079d

      @kendalled video looks very chopy i have no idea why

    22. @@ -0,0 +455,21 @@
      455+ Panel anchored
      456+ </Button>
      457+ <Button
      458+ size="xs"
      459+ variant="outline"
      460+ className={cn(anchoredManager.toasts.length === 0 && "opacity-50")}
      461+ disabled={anchoredManager.toasts.length === 0}
      462+ onClick={() => {
      463+ for (const t of anchoredManager.toasts) {
      464+ anchoredManager.close(t.id);
      465+ }
      466+ }}
      467+ >
      468+ Dismiss all anchored
      469+ </Button>
      470+ </div>
      471+ </CardContent>
      472+ </Card>
      473+ </div>
      474+ );
      475+}

      Dev toast playground route shipped to production

      Low Severity

      A /dev/toast route with a full toast playground (triggering arbitrary toasts of every type, anchored toasts, kitchen-sink demos) is registered in the production route tree with no dev-mode guard. End users can navigate to this route and interact with internal debugging UI. This adds unnecessary bundle weight and exposes internal tooling.

      Additional Locations (1)
      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1d2fa3a7d6563b2ca460435b7673b32f9fd62be9. Configure [here](https://www.cursor.com/dashboard/bugbot).
    23. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 2 total unresolved issues (including 1 from previous review).

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a6ca725a7bcbbf633f8e42b8b6fe4ab7e8832136. Configure [here](https://www.cursor.com/dashboard/bugbot).
    24. all fixes are done and it seems it to pass all the CI/CD as well

    25. juliusmarminge merged this3a1daa8

    26. juliusmarminge closed this

Sign in to join this conversation.