ToastApi
Deprecated
Product subscription app extensions won't be supported as of August 10, 2026. You should migrate existing product subscription app extensions to purchase options extensions.
Deprecated:
Product subscription app extensions won't be supported as of August 10, 2026. You should migrate existing product subscription app extensions to purchase options extensions.
The toast component is a non-disruptive message that appears at the bottom of the interface to provide quick, at-a-glance feedback on the outcome of an action.
import {extend, Button} from '@shopify/admin-ui-extensions';
extend('Admin::Product::SubscriptionPlan::Add', (root, api) => {
const {toast} = api;
const button = root.createComponent(Button, {
title: 'Pop toast',
primary: true,
onPress: () => toast.show('Toast popped!'),
});
root.appendChild(button);
const errorButton = root.createComponent(Button, {
title: 'Do something',
onPress: () => toast.show('That didn’t work.', {error: true}),
});
root.appendChild(errorButton);
root.mount();
});
import {extend, render, useToast, Button} from '@shopify/admin-ui-extensions-react';
function App() {
const {show: showToast} = useToast();
return (
<>
<Button onPress={() => showToast('Toast popped!')} label="Pop toast" />
<Button onPress={() => showToast('That didn’t work.', {error: true})} label="Do something" />
);
}
extend(
'Admin::Product::SubscriptionPlan::Add',
render(() => <App />),
);
JavaScript
import {extend, Button} from '@shopify/admin-ui-extensions';
extend('Admin::Product::SubscriptionPlan::Add', (root, api) => {
const {toast} = api;
const button = root.createComponent(Button, {
title: 'Pop toast',
primary: true,
onPress: () => toast.show('Toast popped!'),
});
root.appendChild(button);
const errorButton = root.createComponent(Button, {
title: 'Do something',
onPress: () => toast.show('That didn’t work.', {error: true}),
});
root.appendChild(errorButton);
root.mount();
});React
import {extend, render, useToast, Button} from '@shopify/admin-ui-extensions-react';
function App() {
const {show: showToast} = useToast();
return (
<>
<Button onPress={() => showToast('Toast popped!')} label="Pop toast" />
<Button onPress={() => showToast('That didn’t work.', {error: true})} label="Do something" />
);
}
extend(
'Admin::Product::SubscriptionPlan::Add',
render(() => <App />),
);Anchor to PropsProps
optional = ?
| Name | Type | Description |
|---|---|---|
| show | (content: string, options: ShowToastOptions) => void | Trigger a toast message to appear. |
| Name | Type | Description |
|---|---|---|
| error? | boolean | Display toast in error format. |
Was this page helpful?