what would be the correct way to center text in an angular snackbar?
I've tried this, which doesn't work:
let config = new MatSnackBarConfig();
config.panelClass = 'center';
this.snackBar.open(message, undefined, config);
and then in some css file (either the same component, or in the global file):
.center {
justify-content: center;
}
You can do it with open()
and panelClass
but you need to modify your CSS:
.center > .mat-simple-snackbar {
justify-content: center;
}
Material Guide aside, this works for our software product:
.mat-snack-bar-container {
text-align: center;
}
.mat-simple-snackbar {
display: inline-block !important;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With