material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[Snackbar] Close button

Open pubiqq opened this issue 3 years ago • 7 comments

It looks like the close button should be available in Snackbar out of the box:

image

pubiqq avatar Oct 24 '22 04:10 pubiqq

Hi @pubiqq,

Thanks for finding details like this!

I don't think the close icon should be shown by default. Under the Anatomy section on the component's spec page it mentions:

4. Icon (optional close affordance)

snackbar_anatomy

I'm going to close this but feel free to re-open if you'd like to discuss or feel differently.

hunterstich avatar Oct 31 '22 19:10 hunterstich

@hunterstich, I don't mean the close button should be shown by default. I mean there should be an option to enable the close button with the API, something like:

Snackbar.make(...)
    .setCloseButtonEnabled(enabled)
    ...

pubiqq avatar Nov 01 '22 06:11 pubiqq

Ah okay. Apologies for misunderstanding

hunterstich avatar Nov 01 '22 12:11 hunterstich

Is there a workaround to display a close icon?

noelstieglitz avatar Jan 27 '23 22:01 noelstieglitz

@hunterstich Hi! Is there any news on this issue?

admitrevskiy avatar Jun 13 '23 15:06 admitrevskiy

@hunterstich I am also impacted

dev1way avatar Jun 13 '23 15:06 dev1way

Is there any workaround in 2024? I cannot find any example also :/.

FANMixco avatar Jul 15 '24 17:07 FANMixco

Is there any workaround in 2025?

mohammaddvi avatar Mar 24 '25 14:03 mohammaddvi

Is there any workaround in 2025?

Do this work? https://github.com/android/snippets/issues/290#issuecomment-2754270578

Can you check it?

FANMixco avatar Mar 27 '25 08:03 FANMixco