Skip to content

Conversation

Hugos68
Copy link
Contributor

@Hugos68 Hugos68 commented Sep 8, 2025

Linked Issue

Closes #3648

Description

Implements the Toast component for React and Svelte

Checklist

Please read and apply all contribution requirements.

  • Your branch should be prefixed with: docs/, feature/, chore/, bugfix/
  • Contributions should target the main branch
  • Documentation should be updated to describe all relevant changes
  • Run pnpm check in the root of the monorepo
  • Run pnpm format in the root of the monorepo
  • Run pnpm lint in the root of the monorepo
  • Run pnpm test in the root of the monorepo
  • If you modify /package projects, please supply a Changeset

Changesets

View our documentation to learn more about Changesets. To create a Changeset:

  1. Navigate to the root of the monorepo in your terminal
  2. Run pnpm changeset and follow the prompts
  3. Commit and push the changeset before flagging your PR review for review.

Copy link

changeset-bot bot commented Sep 8, 2025

⚠️ No Changeset found

Latest commit: 8d0eee5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@Hugos68 Hugos68 marked this pull request as draft September 8, 2025 13:06
Copy link

vercel bot commented Sep 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
themes.skeleton.dev Building Building Preview Comment Sep 11, 2025 8:48pm
www.skeleton.dev Ready Ready Preview Comment Sep 11, 2025 8:48pm

@Hugos68 Hugos68 marked this pull request as ready for review September 9, 2025 11:22
@Hugos68 Hugos68 changed the title feat: toast feat: toast (pending convention update) Sep 9, 2025
@endigo9740
Copy link
Contributor

@Hugos68 updated with the latest changes on main

Also, this is lacking a changeset.


export const classesToast = defineSkeletonClasses({
root: [
'relative p-4 border-1 rounded-container min-w-sm',
Copy link
Contributor

@endigo9740 endigo9740 Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few style adjustments:

  • Prepend card and remove rounded-container
  • p-4 -> p-3 to provide a slimmer profile
  • ring ring-inset ring-surface-200-800 for the outlines
  • preset-filled-surface-50-950 for the fill

Additionally, we need some kind of width control. I'm thinking min-w-* is probably the wrong approach. Consider dropping that in favor of something responsive like Shadcn:

w-full md:w-md

NOTE: just make sure it doesn't touch the edges of the screen on mobile. If so, we need a padding on the wrapping element.

Let me know if you would like me to implement these changes.

'border-surface-200-800 data-[type=success]:border-success-200-800 data-[type=error]:border-error-200-800'
],
group: '',
title: 'h4',
Copy link
Contributor

@endigo9740 endigo9740 Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go ahead and opt for font-medium or font-bold instead of h4. I'd like to keep the slim/sleek design similar to Shadcn:

Screenshot 2025-09-11 at 3 57 35 PM

If the title is one of those parts that Zag forces to be a H1-6, then let's discuss our options. Ephemeral interfaces like Toasts can't really follow the heading order for a11y, so it's nearly impossible to set a default. Given this, I think this would be better to forego the heading in favor of <p class="font-medium">

title: 'h4',
description: '',
actionTrigger: '',
closeTrigger: 'absolute top-1/2 -translate-y-1/2 right-4 btn-icon hover:preset-tonal'
Copy link
Contributor

@endigo9740 endigo9740 Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but it's a bit messy. Zag's markup doesn't given us a proper option to fix this, so we may need to introduce a new custom element to wrap the text message. That'll allow us to do this:

Screenshot 2025-09-11 at 4 31 19 PM

Tailwind Playground:
https://play.tailwindcss.com/bfXTpqgqd9

This will also make it for users to implement leading icons on the far left of the flex-row.


<button
class="btn preset-filled"
onclick={() => toaster.info({ title: 'Title', description: 'The value of foo is:', meta: { foo: 'bar' } })}
Copy link
Contributor

@endigo9740 endigo9740 Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we wrap the inner object for readability; for both frameworks.

It's always helpful to show a practical example. Consider using this to showcase the template configuration per the discussion on Discord earlier. Examples layout ideas:

  • With/without icons
  • Rearranged the template order (ex: action first)
  • Some kind of high styled variation outside of default/error/success (ex: warning)

@@ -0,0 +1,75 @@
---
Copy link
Contributor

@endigo9740 endigo9740 Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to explain that this works as a singleton. That the component should be configured at the broadest scope you can (ex: root +layout.svelte for SvelteKit). Then can be called on demand throughout the app.

@@ -0,0 +1,75 @@
---
layout: '@layouts/LayoutDoc.astro'
Copy link
Contributor

@endigo9740 endigo9740 Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're also missing examples for:

  • Action button
  • Success/Error - See the v3 docs for inspiration.

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.

v4 Component: Toast
2 participants