Skip to content

useSnackbar()

WARNING

Single File Component (SFC) support for Administration extensions is experimental. It is currently only available on the trunk branch of shopware/shopware and is not part of any 6.7 release. The APIs described on this page can still change without a deprecation.

ts
import { useSnackbar } from 'shopware:composables/use-snackbar';

function useSnackbar(): {
    addSnackbar: (config: Omit<Snackbar, 'id'>) => Snackbar;
    removeSnackbar: (id: string) => void;
};

Snackbars: the short-lived bar at the bottom of the screen, for something that happened rather than something that needs attention. Use useNotification() when the message should stay.

It wraps the Meteor component library's own useSnackbar(), so config is a Meteor Snackbar without its id, and addSnackbar() returns the snackbar it created, id included - keep it if you want to remove the snackbar before it disappears on its own.

Was this page helpful?
UnsatisfiedSatisfied
Be the first to vote!
0.0 / 5  (0 votes)