.An opinionated tribute part for Vue. It's a Vue slot of Sonner.Examine.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Overview.Vue Sonner is an opinionated toast part for Vue. It is actually personalized, yet styled by default. Comes with a wipe to dismiss computer animation.Installment.To start making use of the library, install it in your venture:.pnpm put in vue-sonner.or even.yarn include vue-sonner.Utilization.For Vue 3.
Provide a toast.
For Nuxt 3.Describe a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster, salute coming from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) => nuxtApp.vueApp.component(' Toaster oven', Toaster Oven).profits supply: salute. ).Use Toaster element and $toast feature anywhere in the Vue SFC.
Make a salute.
Add the develop transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig coming from 'nuxt/config'.export nonpayment defineNuxtConfig( ...create: transpile: [' vue-sonner'] ).CDN Web link.EMS variation.https://cdn.jsdelivr.net/npm/vue-sonner/+esm.UMD model.https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs.Styles.Nonpayment.The majority of fundamental salute. You can easily customize it (and also any other kind) through passing a choices object as the 2nd debate.toast(' Occasion has been actually generated').With personalized explanation:.tribute(' Occasion has actually been actually generated', explanation: 'Monday, January third at 6:00 pm'. ).Success.Leaves a checkmark image in front of the notification.toast.success(' Activity has been actually produced').Error.Leaves a mistake icon in front of the notification.toast.error(' Activity has certainly not been developed').Action.Renders a switch.toast(' Activity has actually been generated', activity: tag: 'Undo',.onClick: () => console.log(' Undo'). ).Promise.Begins in a loading state as well as will improve instantly after the promise fixes or neglects.You can pass a feature to the success/error notifications to integrate the result/error of the guarantee.toast.promise(() => new Guarantee(( resolve) => setTimeout( fix, 2000)), loading: 'Loading',.excellence: (records: any) => 'Success',.error: (information: any kind of) => 'Error'. ).Custom-made Component.You can pass a Vue Element as the initial debate as opposed to a strand to make custom Element while maintaining nonpayment styling. You may make use of the headless model listed below for a custom, unstyled salute.Modification.Headless.You can easily make use of toast.custom to make an unstyled salute with custom jsx while keeping the performance.Theme.You may change the motif using the motif uphold. Default theme is light.Posture.You may modify the placement through the placement set on the part. Default is actually top-right.
Broadened.Salutes can easily likewise be increased through default through the increase prop. You can likewise change the volume of noticeable tributes which is 3 through default.Styling for all salutes.You can easily type your tributes internationally with the toastOptions uphold in the Toaster oven element.Styling for personal tribute.toast(' Occasion has been actually generated', design: history: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close switch.Include a near button to all toasts that reveals on hover through including the closeButton set.Rich colours.You can easily produce mistake and also effectiveness state much more vivid by including the richColors uphold.Custom-made made up for.Offset from the edges of the display.Programmatically eliminate salute.To get rid of a salute programmatically make use of toast.dismiss( id).const toastId = tribute(' Occasion has been actually produced').toast.dismiss( toastId).You can also use the dismiss approach without the id to dismiss all tributes.toast.dismiss().Programmatically eliminate salute.You can easily change the period of each salute by utilizing the period quality, or even alter the period of all tributes enjoy this:.toast(' Celebration has actually been actually generated', timeframe: 10000. ).// Persisent toast.salute(' Event has been actually made', period: Infinity. ).On Close Callback.You can pass onDismiss and also onAutoClose callbacks. onDismiss gets axed when either the near button acquires clicked on or the tribute is actually wiped. onAutoClose fires when the tribute vanishes automatically after it's timeout (duration prop).tribute(' Event has actually been developed', onDismiss: (t) => console.log( 'Toast with i.d. $ t.id has been actually disregarded '),.onAutoClose: (t) =>console.log( 'Salute along with i.d. $ t.id has actually been actually finalized immediately '). ).Computer keyboard focus.You can pay attention to the salute aspect through pressing u2325/ alt + T. You can bypass it through supplying a variety of event.code worths for each key.Creativity.sonner - An opinionated tribute component for React.