@wilmer.lemke
In Vuetify, you can easily display snackbars using the v-snackbar
component. Below is an example on how to display a basic snackbar in Vuetify:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<template> <v-btn @click="showSnackbar">Show Snackbar</v-btn> <v-snackbar v-model="snackbar" :timeout="5000">Snackbar message!</v-snackbar> </template> <script> export default { data() { return { snackbar: false, }; }, methods: { showSnackbar() { this.snackbar = true; }, }, }; </script> |
In this example, we have a v-btn
component that triggers the showSnackbar
method when clicked. The v-snackbar
component is hidden until the snackbar
data property is set to true. The snackbar will automatically close after 5000ms (5 seconds) due to the timeout
prop.
You can customize the appearance and behavior of the snackbar by adding props to the v-snackbar
component. For example, you can change the color, position, and transition of the snackbar by using the color
, top
, bottom
, and transition
props, respectively.
For more information on customizing snackbars in Vuetify, you can refer to the Vuetify documentation: https://vuetifyjs.com/en/components/snackbars/