Toast API
The Toast API displays a non-disruptive message that appears at the bottom of the interface to provide quick and short feedback on the outcome of an action. App Home UI extensions access toast notifications through shopify.toast on the shopify global object. This API is modeled after the Web Notification API.
Anchor to Use casesUse cases
- Success feedback: Show confirmation messages after successful save, create, or update operations.
- Error notification: Display non-blocking error messages when operations fail.
- Action buttons: Include action buttons in toasts for quick follow-up actions like undoing changes.
- Temporary alerts: Communicate brief, time-limited messages that don't require user acknowledgment.
Anchor to MethodsMethods
The object provides methods for displaying temporary notification messages. Access these methods through shopify.toast to show user feedback and status updates.
- Anchor to hidehidehide() => void() => voidrequiredrequired
Dismisses any currently visible toast notification. Use this to programmatically hide a toast before its duration expires.
- Anchor to showshowshow(message: string, options?: ToastOptions) => void(message: string, options?: ToastOptions) => voidrequiredrequired
Displays a toast notification with the specified message. The toast appears as a temporary overlay that automatically dismisses after the specified duration. Use for providing immediate user feedback, confirming actions, or communicating status updates without interrupting the user's workflow.
ToastOptions
Options for configuring toast notification behavior and appearance.
- action
The label for an optional action button displayed in the toast. When provided, an action button appears that the user can click.
string - duration
The duration in milliseconds to display the toast before automatically dismissing. If not specified, a default duration is used.
number - isError
Whether to display the toast as an error notification. Use for error messages or failed operations.
boolean - onAction
Callback function triggered when the user clicks the action button. Only called if `action` is provided.
() => void - onDismiss
Callback function triggered when the toast is dismissed, either automatically after the duration expires or manually by the user.
() => void