Skip to content

feat(toast): stack toasts like a deck and restyle the toast - #158

Merged
riccardoperra merged 7 commits into
mainfrom
feat/sonner-style-toasts
Nov 30, 2026
Merged

riccardoperra merged 7 commits into
mainfrom
feat/sonner-style-toasts

Conversation

@riccardoperra

Copy link
Copy Markdown
Owner

Summary

Stacked toasts (Sonner-style), now the default. The newest toast sits in front and up to two older ones peek 12px behind it, at 95% and 90% scale with their content hidden. Hovering or focusing the stack fans the toasts out to full height, and leaving collapses it. Bottom and top positions both stack, mirrored.

  • stack.ts measures each toast (ResizeObserver and MutationObserver) and sets --cui-toast-index, --cui-toast-offset, --cui-toast-height, the list's front height and stack height, and data-cui-stack-index.
  • The movement is pure CSS on [data-cui-stack]. It uses the translate, scale and clip-path properties, not transform, so swipe and the rise keyframe keep working. Back cards are clipped only on the side hidden behind the front card, so they keep their shadow and rounded corners.
  • New expand prop on Toaster keeps the old full list. The Tones story uses it.

Toast restyle. A description under a title takes --cui-text-muted with 2px between them. The tone icon goes from 16px to 20px, so the circle measures 16px, and it aligns with the title row. The leading padding grows to 16px.

Also: a Stacked story, DESIGN.md §7 and motion.mdx notes, a changeset (minor for @codeui/solid and @codeui/styles), and a reusable journeys/toast-stack.mjs with its feature-map entry.

Verification

  • verify-codeui, designsystem-toaster--stacked, both themes: collapsed layout (the front card is lowest and two peek above with hidden content), hover fans out with no overlap, the stack collapses on pointer leave, and Tab fans it out. All checks pass.
  • designsystem-toaster--interactive (top-right): the stack mirrors downward.
  • Existing toast-rise journey, plus the Tones, RichContent and Loading stories: pass.
  • @codeui/styles check, kit tsc, and test/toaster.test.tsx (23 tests): pass. The STRICT_READ_UNTRACKED warnings also appear on main.
  • Not proven: the motion itself. The harness disables animations.

🤖 Generated with Claude Code

Toasts stack with the newest in front and fan out on hover or focus.
`expand` keeps the full list. The description takes the muted colour
under a title and the tone icon grows to 20px, aligned with the title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f6eb69d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@codeui/solid Minor
@codeui/styles Minor
@codeui/storybook-playground Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

CodeUI package preview

Built from f6eb69d.

npm install https://pkg.pr.new/riccardoperra/codeui/@codeui/solid@f6eb69d87ed0b95f0a48b2115641b38ff3e624eb

Installing @codeui/solid also installs matching previews of @codeui/styles and @codeui/inkstone.

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview deployed to Cloudflare Pages.

Built from f6eb69d.

Replaces Kobalte's toast region behind createToaster and Toaster with
our own engine: transitions for enter and leave, a deck stack that fans
out on hover or focus, timers that pause while expanded or hidden, a
limit that hides older toasts instead of queueing, and swipe toward the
region's edge. The styled Kobalte parts are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An app style that stretches the region (the docs demo frame sets
`w-full` on direct child sections from the utilities layer) made the
stacked toasts span the viewport. The list now caps itself at 480px and
aligns to the region's side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Toasts now render in the theme around the Toaster. `theme="inverted"`
on the Toaster, or on one toast, keeps the light-on-dark card. Adds
`ToastTheme` and an Inverted story.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…astTheme

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@riccardoperra
riccardoperra merged commit 5d9da9f into main Nov 30, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
docs-preview — f6eb69d8 Deployed Nov 30, 2026 by riccardoperra via Deploy to Cloudflare Pages #188
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.

1 participant