Notistack: New line in messege

Created on 2 Dec 2018  路  5Comments  路  Source: iamhosseindhv/notistack

Hi,
is that possible to add a new line mark in the notistack messege text?
I tried '\n' and '
' in many variants but its always printed as writed. 馃槩

Most helpful comment

For these googling the solution:

enqueueSnackbar(msg, {
      variant: 'error',
      style: { whiteSpace: 'pre-line' }
})

All 5 comments

Hi @kubalobo, I'm not sure if it's possible. maybe material-ui issues is a better place to ask this. However, you can pass whatever you want as the body of snackbar in options paramters of enqueueSnackbar.

this.props.enqueueSnackbar('I love snacks', {
    children: (
         <div> my entirely customised snack </div>
    ),
});

Thanks, but unfortunenetly it looks like children parameter doesn't change anything. Are you that it's a proper syntax?

@kubalobo which version of notistack are you using? The children option was fixed in v0.3.9, see issue #22

Yea, I had 0.3.7. It's working fine after update.
Thanks!

For these googling the solution:

enqueueSnackbar(msg, {
      variant: 'error',
      style: { whiteSpace: 'pre-line' }
})
Was this page helpful?
0 / 5 - 0 ratings

Related issues

seannguyn picture seannguyn  路  4Comments

ksavery picture ksavery  路  3Comments

lsansaa picture lsansaa  路  7Comments

Gareon picture Gareon  路  3Comments

alexisab picture alexisab  路  5Comments