SweetUI

Search items

Jump to an item

component

toast

Transient status toast: informational, positive, destructive; optional action; swipe/tap/timed dismissal.

toastsnackbarnotificationfeedbackstatusshadcn
toast, light

On iPad

The same installed source at a regular width. It adapts its layout without a separate design.

toast on iPad, light

Install

With the sweetui tool (brew install mangobyte-dev/tap/sweetui):

sweetui install toast --destination Sources/YourFeature/Components

Installs in order: button 0.5.2, toast 0.1.1. Point --destination at a folder inside the consuming target's sources.

Usage

@State private var toast: RegistryToast?

CardDetail()
    .registryToast($toast)

// Present a destructive toast with an undo action:
toast = RegistryToast(
    title: "Message deleted",
    message: "You can undo this for a few seconds.",
    variant: .destructive,
    action: RegistryToast.Action(label: "Undo") { restoreMessage() }
)

Accessibility contract

  • Variant pairs symbol with color. MUST NOT rely on color alone.
  • Posts VoiceOver announcement from title+message; keeps focus.
  • Title+message combine; action, close stay separate.
  • Close carries Dismiss label; symbol hidden; tone via text.
  • Reduce Motion: fade not slide; title shrinks; message wraps 2 lines.

Details

Kindcomponent
Version0.1.1
PlatformsiOS 26.0+
Dependenciesbutton
SourceRegistry/sources/components/RegistryToastModifier.swift
Xcode previewToast