Example
// also available globally on window import { mcSnackbar } from '@thewebformula/materially/services'; // import { mcSnackbar } from '@thewebformula/materially mcSnackbar.show({ message: 'Message goes here' });
Actions
// also available globally on window import { mcSnackbar } from '@thewebformula/materially/services'; // import { mcSnackbar } from '@thewebformula/materially // Promise will resolve when the Snackbar is dismissed automatically or when action is pressed await mcSnackbar.show({ message: 'Message goes here', action: true, actionLabel: 'Done' // default 'Dismiss' }); console.log('Snackbar dismissed');
No close button and longer time
// also available globally on window import { mcSnackbar } from '@thewebformula/materially/services'; // import { mcSnackbar } from '@thewebformula/materially mcSnackbar.show({ message: 'Message goes here', closeButton: false, ms: 6000 });
Style
CSS variables that allow you override default values
/* Optional variables for overriding */ --mc-snackbar-container-color: var(--mc-surface-inverse); --mc-snackbar-text-color: var(--mc-on-surface-inverse); --mc-snackbar-action-color: var(--mc-primary-container);