Sleep

Vue- sonner - Vue.js Nourished

.An opinionated tribute element for Vue. It's a Vue port of Sonner.Sneak peek.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Introduction.Vue Sonner is actually an opinionated tribute component for Vue. It is actually personalized, but designated by nonpayment. Comes with a wipe to dismiss computer animation.Installment.To begin making use of the collection, mount it in your venture:.pnpm mount vue-sonner.or even.yarn include vue-sonner.Consumption.For Vue 3.
Make a salute.
For Nuxt 3.Describe a nuxt plugin.// plugins/sonner. client.ts.import Toaster, toast from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster).come back give: tribute. ).Use Toaster oven element as well as $toast feature throughout the Vue SFC.
Provide a tribute.
Add the create transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig coming from 'nuxt/config'.export default defineNuxtConfig( ...build: transpile: [' vue-sonner'] ).CDN Link.EMS model.https://cdn.jsdelivr.net/npm/vue-sonner/+esm.UMD version.https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs.Types.Default.Most fundamental salute. You may tailor it (and also every other type) by passing an alternatives things as the 2nd debate.toast(' Activity has been developed').Along with customized description:.salute(' Celebration has actually been actually generated', description: 'Monday, January 3rd at 6:00 pm'. ).Results.Renders a checkmark symbol before the information.toast.success(' Occasion has been actually developed').Mistake.Leaves an inaccuracy image facing the notification.toast.error(' Event has certainly not been developed').Activity.Presents a button.toast(' Event has actually been actually produced', action: label: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Pledge.Starts in a loading condition and also is going to update instantly after the commitment addresses or stops working.You may pass a function to the success/error information to incorporate the result/error of the promise.toast.promise(() =&gt brand new Pledge(( fix) =&gt setTimeout( resolve, 2000)), packing: 'Packing',.excellence: (records: any type of) =&gt 'Results',.inaccuracy: (records: any type of) =&gt 'Mistake'. ).Custom-made Part.You may pass a Vue Component as the first disagreement rather than a string to render custom Element while sustaining default designing. You may utilize the brainless version below for a customized, unstyled toast.Personalization.Headless.You can make use of toast.custom to provide an unstyled salute along with custom jsx while keeping the functions.Concept.You can alter the motif utilizing the motif uphold. Default theme is light.Position.You can easily alter the position by means of the position uphold on the part. Nonpayment is actually top-right.
Expanded.Tributes may additionally be increased by default via the increase uphold. You can additionally alter the quantity of obvious toasts which is 3 by nonpayment.Styling for all tributes.You may design your toasts worldwide with the toastOptions set in the Toaster component.Designing for individual salute.toast(' Occasion has been developed', type: history: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near button.Include a close switch to all salutes that presents on hover by incorporating the closeButton set.Rich colors.You can produce inaccuracy and effectiveness condition much more multicolored through including the richColors set.Custom countered.Countered coming from the edges of the monitor.Programmatically remove salute.To eliminate a toast programmatically utilize toast.dismiss( id).const toastId = salute(' Occasion has been produced').toast.dismiss( toastId).You can easily also utilize the dismiss approach without the id to put away all salutes.toast.dismiss().Programmatically clear away toast.You can modify the length of each salute by utilizing the period home, or even alter the period of all tributes enjoy this:.tribute(' Event has been made', period: 10000. ).// Persisent toast.toast(' Activity has been made', duration: Immensity. ).On Shut Callback.You may pass onDismiss as well as onAutoClose callbacks. onDismiss gets discharged when either the near button obtains clicked on or the toast is swiped. onAutoClose fires when the tribute goes away automatically after it's timeout (timeframe set).toast(' Celebration has been created', onDismiss: (t) =&gt console.log( 'Toast with id $ t.id has been actually dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Tribute with i.d. $ t.id has actually been closed immediately '). ).Key-board emphasis.You can focus on the tribute field by pushing u2325/ alt + T. You can override it by giving a selection of event.code values for each and every secret.Inspiration.sonner - An opinionated salute component for React.