Sleep

Vue- sonner - Vue.js Feed

.An opinionated toast element for Vue. It is actually a Vue port of Sonner.Preview.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Introduction.Vue Sonner is an opinionated toast part for Vue. It is actually customizable, but designated by nonpayment. Includes a swipe to disregard animation.Installment.To begin making use of the public library, mount it in your job:.pnpm mount vue-sonner.or even.anecdote add vue-sonner.Use.For Vue 3.
Leave a salute.
For Nuxt 3.Define a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster oven, toast from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).come back offer: toast. ).Make use of Toaster oven element and also $tribute function throughout the Vue SFC.
Leave a toast.
Add the develop transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig from 'nuxt/config'.export nonpayment defineNuxtConfig( ...construct: transpile: [' vue-sonner'] ).CDN Web 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.Kinds.Nonpayment.A lot of simple salute. You can easily tailor it (as well as any other style) by passing an options item as the 2nd debate.salute(' Occasion has been generated').With customized description:.salute(' Occasion has been actually developed', summary: 'Monday, January third at 6:00 pm'. ).Excellence.Leaves a checkmark icon facing the information.toast.success(' Activity has actually been actually generated').Mistake.Leaves an error image facing the information.toast.error(' Activity has not been generated').Activity.Provides a switch.tribute(' Activity has actually been made', activity: label: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Promise.Begins in a packing state and also is going to upgrade instantly after the commitment fixes or stops working.You may pass a feature to the success/error information to integrate the result/error of the commitment.toast.promise(() =&gt new Pledge(( fix) =&gt setTimeout( resolve, 2000)), filling: 'Packing',.excellence: (information: any) =&gt 'Success',.inaccuracy: (records: any) =&gt 'Inaccuracy'. ).Custom-made Element.You can easily pass a Vue Part as the first argument instead of a cord to make customized Component while maintaining default styling. You can utilize the brainless model below for a custom, unstyled toast.Customization.Brainless.You can use toast.custom to leave an unstyled tribute along with custom-made jsx while preserving the capability.Motif.You can easily alter the style utilizing the concept set. Default concept is actually light.Posture.You can modify the position through the posture prop on the component. Nonpayment is actually top-right.
Increased.Tributes can also be expanded by nonpayment through the expand uphold. You may likewise alter the amount of noticeable salutes which is 3 by default.Styling for all toasts.You can design your tributes internationally with the toastOptions set in the Toaster oven element.Styling for individual toast.salute(' Celebration has actually been actually made', type: history: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near button.Add a close switch to all toasts that shows on hover through adding the closeButton uphold.Rich shades.You can easily produce error and excellence state more vivid through including the richColors uphold.Customized balanced out.Balanced out from the sides of the display.Programmatically get rid of toast.To take out a salute programmatically utilize toast.dismiss( i.d.).const toastId = tribute(' Occasion has actually been generated').toast.dismiss( toastId).You can likewise make use of the dismiss approach without the i.d. to dismiss all toasts.toast.dismiss().Programmatically eliminate salute.You can alter the period of each tribute by utilizing the duration home, or even alter the period of all toasts such as this:.salute(' Celebration has actually been developed', length: 10000. ).// Persisent salute.tribute(' Occasion has been actually generated', period: Immensity. ).On Close Callback.You can easily pass onDismiss as well as onAutoClose callbacks. onDismiss obtains shot when either the near button acquires clicked or even the tribute is wiped. onAutoClose fires when the toast fades away immediately after it's timeout (timeframe set).salute(' Celebration has actually been actually produced', onDismiss: (t) =&gt console.log( 'Tribute with id $ t.id has actually been actually dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Toast with id $ t.id has actually been actually finalized automatically '). ).Computer keyboard concentration.You can easily concentrate on the toast field through pushing u2325/ alt + T. You can bypass it through giving an array of event.code values for every trick.Motivation.sonner - An opinionated salute component for React.