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.
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
)
}
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 |