PHP
use yh\mdc\components\SnackBar;
echo Snackbar::one('')
->setProperty([
'closeButton' => Yii::t('backend', 'Close'),
'captionButton' => 'Alt button',
'leading' => true,
])
->setId('app-snackbar')
->render();
JavaScript
const sb = app.controls.item('app-snackbar');
sb.size('30%');
sb.add('Text1');
sb.add('Text2');
sb.showMessage();
let callback = () => {
sb.unlisten('MDCSnackbar:closed', callback);
sb.trailing = true;
sb.showMessage('Text1');
};
sb.listen('MDCSnackbar:closed', callback);
Samples