Fixed Confirmation Toast

Fixed Confirmation Toast is used as an alert. Success is used when a user successfully completes an action. Error is used when there is an error and the user cannot proceed. Neutral is used to display information to a user to complete a task.

Default

Default-Toast

VStack(alignment: .leading) {
  PBToast(text: "Error Message", variant: .error, dismissAction: closeToast)
  PBToast(text: "Items Successfully Moved", variant: .success, dismissAction: closeToast)
  PBToast(text: "Scan to Assign Selected Items", variant: .neutral, dismissAction: closeToast)
}
Multi Line

Multiline-Toast

PBToast(
  text: message,
  variant: .custom(.infoCircle, .pbPrimary),
  dismissAction: closeToast
)
Children

Children-Toast

VStack(alignment: .leading) {
  PBToast(
    text: message,
    variant: .success,
    actionView: .custom(AnyView(Text("Undo").pbFont(.title4, color: .white))),
    dismissAction: closeToast
  )
  PBToast(
    variant: .custom(nil, .pbPrimary),
    actionView: .custom(
    AnyView(
      HStack {
        Text("Undo action").pbFont(.caption, color: .white)
        PBButton(variant: .primary, title: "Undo").disabled(true)
      }
    )),
    dismissAction: closeToast
  )
}

Props

Name Type Description Default Values
text String Value for the toast message nil
variant Variant Determines the type pf toast message being displayed .custom() error, success,
neutral, custom()
actionView dismissAction Dismisses the toast message .default default custom() withTimer()
dismissAction (() -> Void) Triggers the dismiss action