vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

[Bug Report][3.7.0] I can't define default slot when adding an item to SnackbarQueue

Open etienne-monier opened this issue 1 year ago • 5 comments

Environment

Vuetify Version: 3.7.0 Vue Version: 3.4.27 Browsers: Chrome 125.0.0.0 OS: Linux x86_64

Steps to reproduce

Push a notification to snackbar queue with "v-slot:default" prop.

Expected Behavior

The text/node in "v-slot:default" prop renders in the snackbar.

Actual Behavior

The snackbar is empty

Reproduction Link

https://play.vuetifyjs.com/#...

Other comments

This prop appears in the API.

etienne-monier avatar Aug 23 '24 15:08 etienne-monier

Oh, that's just a documentation mistake. So, what's the correct usage? It seems a callable returning a node is expected.

etienne-monier avatar Aug 24 '24 19:08 etienne-monier

The prop doesn't actually exist, it's in the docs because items is typed as VSnackbar['$props'][] and slots are added to prop types for JSX but are only valid directly on a JSX element not in a props object.

KaelWD avatar Aug 25 '24 05:08 KaelWD

Oh! So that's impossible to add complex snackbars (mine has a title with icon and a text) to the queue. We must use props only and so simple snackbars with text only. That's it?

etienne-monier avatar Aug 25 '24 06:08 etienne-monier

Yes, SnackbarQueue itself has some slots though.

KaelWD avatar Aug 26 '24 09:08 KaelWD

Ok, I found out how to do that. Here is an example.

My last issue: How to make a closable button? Using classic snackbar, I can use the snackbar model as in this example. I tried to shift the model array in the above playground, but this does not seems to work...

etienne-monier avatar Aug 26 '24 12:08 etienne-monier

Ok, I found out how to do that. Here is an example.

My last issue: How to make a closable button? Using classic snackbar, I can use the snackbar model as in this example. I tried to shift the model array in the above playground, but this does not seems to work...

any luck on this?

--- EDIT: in case anyone else needs this...

<v-snackbar-queue closable="true" close-text="Close" v-model="notificationQueue">

jumptrnr avatar Sep 11 '24 21:09 jumptrnr