Toast APIAPIs
APIs
The Toast API allows the display of a Toast component.
Anchor to toastapiToastApi
Anchor to show
show
(content: string, options?: ) => void
required
Show a toast.
Was this section helpful?
Anchor to examplesExamples
Examples of using the Toast API
Anchor to example-display-a-toast-component-from-the-tileDisplay a Toast component from the tile
Was this section helpful?
Display a Toast component from the tile
import React from 'react';
import {
Tile,
useApi,
reactExtension,
} from '@shopify/ui-extensions-react/point-of-sale';
const SmartGridTile = () => {
const api = useApi<'pos.home.tile.render'>();
return (
<Tile
title="My App"
onPress={() => api.toast.show('Toast content', 5000)}
enabled
/>
);
};
export default reactExtension('pos.home.tile.render', () => <SmartGridTile />);