1

I can't access the width of the material-ui snackbar. When I use bodyStyle property and change height the app is updated accordingly. But why is width not changing?

jssql
  • 235
  • 1
  • 3
  • 9

2 Answers2

2

You should add bodyStyle attribute with maxWidth and height, e.g.:

<Snackbar bodyStyle={{ maxWidth: '100%', height: 'auto' }} ... />
marcelovca90
  • 2,673
  • 3
  • 27
  • 34
Alwin
  • 153
  • 1
  • 6
0

Use the bodyStyle property, and set flexGrow to zero (material-ui has it set to 1 which is overriding the width):

<Snackbar message="BIG snack" bodyStyle={{ height: 200, width: 200, flexGrow: 0 }} open />
Jeff McCloud
  • 5,777
  • 1
  • 19
  • 21