Components: Is there any way I can add multiline in Snackbar?

Created on 9 May 2018  路  4Comments  路  Source: angular/components

Bug, feature request, or proposal:

Question / Feature request

What is the expected behavior?

String array can be used to display text on Snackbar in multiline

What is the current behavior?

Single string is displaying in a single line in Snackbar

What is the use-case or motivation for changing an existing behavior?

Multiline text in Snackbar

Most helpful comment

You could also use the stock component, pass a message with newlines, and set a custom panelClass option that applies white-space: pre-wrap or similar. I tested this and it works for me.

All 4 comments

Snackbars support passing in custom components instead of just strings: https://material.angular.io/components/snack-bar/examples

You can template that component however you wish

What @willshowell said

You could also use the stock component, pass a message with newlines, and set a custom panelClass option that applies white-space: pre-wrap or similar. I tested this and it works for me.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

theunreal picture theunreal  路  3Comments

shlomiassaf picture shlomiassaf  路  3Comments

crutchcorn picture crutchcorn  路  3Comments

julianobrasil picture julianobrasil  路  3Comments

alanpurple picture alanpurple  路  3Comments