material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Snackbar] Make composable

Open piotr-dobrogost opened this issue 10 years ago • 7 comments

Although it's against material ui guidelines regarding snackbar – Components– Snackbars & toasts – some users find it odd not to have close icon in snackbar and Google itself uses snackbar with close icon in its Inbox web app as shown below: google inbox snackbar

As currently it's not possible to extend Snackbar with this icon without basically reimplementing whole component I propose to add optional close icon to snackbar.

piotr-dobrogost avatar Jan 08 '16 10:01 piotr-dobrogost

@nathanmarks ?

piotr-dobrogost avatar Apr 13 '16 07:04 piotr-dobrogost

@piotr-dobrogost Adding an optional close action is the wrong direction. The component should be composable instead.

nathanmarks avatar Apr 13 '16 13:04 nathanmarks

Thanks for changing title and reopening.

piotr-dobrogost avatar Apr 13 '16 14:04 piotr-dobrogost

Material design specs clearly say that for two or more actions you should use a dialog box and not a Snackbar so I think making it composable might also not be the right direction. @oliviertassinari Why don't you want the action button to be defined as a Flat Button inside the API? As action Button is always a clickable text so why not make it easy for the user by creating a Flat Button inside the API letting the user to pass only the text?

Shahrukh-Zindani avatar Mar 15 '17 21:03 Shahrukh-Zindani

why not make it easy for the user by creating a Flat Button inside the API letting the user to pass only the text?

Because users want to mess around, change properties, add an icon, etc.

oliviertassinari avatar Mar 15 '17 22:03 oliviertassinari

Right. I get that but how close to material design specs will that user be if he adds icons and messes around as Snack bar is supposed to have a message and an action button only. I guess I can expose the action prop and in the demos use an example with a Button that shows the most common Snackbar example.

Shahrukh-Zindani avatar Mar 15 '17 22:03 Shahrukh-Zindani

I would say that is up to the users to decide if they want to be close as possible to the material design specs. With the Snack bar being composable, users can easily achieve what is in the Material Design specs, but they can also do more.

stunaz avatar Mar 16 '17 13:03 stunaz