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.
NOTE: z index for Fixed Confirmation Toast is set to 'max' by default which has the value of 999999. the z Index global prop can be used to override this if you want to set it to a different value.
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 |
|
| font | PBFont |
Value for the toast message font style |
.title4 |
|
| animatedIcon | AnyView |
Value for the option to use an animated icon |
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 |