.An opinionated salute component for Vue. It is actually a Vue port of Sonner.Sneak peek.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Intro.Vue Sonner is an opinionated toast component for Vue. It's customizable, however styled through default. Possesses a wipe to dismiss computer animation.Setup.To begin using the public library, mount it in your job:.pnpm set up vue-sonner.or even.anecdote include vue-sonner.Usage.For Vue 3.
Leave a tribute.
For Nuxt 3.Describe a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster oven, tribute coming from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) => nuxtApp.vueApp.component(' Toaster', Toaster).come back deliver: tribute. ).Make use of Toaster element and $tribute function anywhere in the Vue SFC.
Leave a salute.
Incorporate the develop transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig from 'nuxt/config'.export nonpayment defineNuxtConfig( ...construct: transpile: [' vue-sonner'] ).CDN Web link.Ambulance version.https://cdn.jsdelivr.net/npm/vue-sonner/+esm.UMD variation.https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs.Kinds.Default.A lot of standard tribute. You can individualize it (and also some other type) through passing a choices object as the second argument.salute(' Celebration has actually been produced').Along with personalized explanation:.tribute(' Celebration has actually been actually made', summary: 'Monday, January third at 6:00 pm'. ).Effectiveness.Makes a checkmark symbol facing the notification.toast.success(' Event has actually been generated').Inaccuracy.Leaves an inaccuracy symbol before the notification.toast.error(' Celebration has actually not been generated').Activity.Provides a button.salute(' Occasion has been actually developed', action: tag: 'Undo',.onClick: () => console.log(' Undo'). ).Promise.Starts in a filling state and will definitely improve instantly after the commitment solves or stops working.You can pass a function to the success/error information to incorporate the result/error of the promise.toast.promise(() => new Assurance(( fix) => setTimeout( fix, 2000)), loading: 'Packing',.excellence: (records: any kind of) => 'Effectiveness',.mistake: (records: any kind of) => 'Inaccuracy'. ).Personalized Part.You can pass a Vue Element as the very first disagreement as opposed to a cord to render custom-made Component while maintaining default designing. You may use the headless version listed below for a custom-made, unstyled tribute.Customization.Brainless.You can make use of toast.custom to make an unstyled toast with customized jsx while sustaining the functionality.Motif.You may alter the concept using the motif prop. Default style is actually light.Setting.You may alter the placement through the placement uphold on the component. Default is actually top-right.
Grown.Tributes may likewise be actually increased through nonpayment by means of the increase prop. You may also alter the amount of noticeable salutes which is 3 by nonpayment.Designing for all toasts.You can easily design your toasts around the globe along with the toastOptions uphold in the Toaster component.Styling for individual salute.toast(' Activity has actually been created', design: history: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close button.Add a near button to all toasts that reveals on hover by including the closeButton uphold.Rich colors.You may make inaccuracy as well as success condition more vivid through adding the richColors set.Customized offset.Made up for from the sides of the display.Programmatically remove tribute.To remove a salute programmatically use toast.dismiss( i.d.).const toastId = toast(' Occasion has been actually generated').toast.dismiss( toastId).You can easily additionally utilize the dismiss method without the i.d. to dismiss all toasts.toast.dismiss().Programmatically clear away tribute.You can easily change the timeframe of each salute by utilizing the length home, or even modify the timeframe of all tributes like this:.tribute(' Celebration has been actually produced', period: 10000. ).// Persisent tribute.salute(' Celebration has actually been generated', length: Infinity. ).On Shut Callback.You may pass onDismiss and also onAutoClose callbacks. onDismiss gets discharged when either the near switch obtains clicked on or the toast is actually wiped. onAutoClose fires when the tribute disappears automatically after it is actually timeout (timeframe uphold).tribute(' Activity has been actually created', onDismiss: (t) => console.log( 'Tribute with id $ t.id has actually been disregarded '),.onAutoClose: (t) =>console.log( 'Salute with id $ t.id has actually been actually shut instantly '). ).Computer keyboard focus.You can focus on the salute area by pressing u2325/ alt + T. You can easily override it by supplying an array of event.code market values for every secret.Creativity.sonner - An opinionated salute element for React.