Sleep

Vue- sonner - Vue.js Supplied

.An opinionated salute component for Vue. It is actually a Vue slot of Sonner.Preview.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Introduction.Vue Sonner is an opinionated salute component for Vue. It's customizable, yet designated by default. Features a wipe to dismiss animation.Installment.To begin making use of the collection, mount it in your venture:.pnpm put in vue-sonner.or even.yarn add vue-sonner.Consumption.For Vue 3.
Render a tribute.
For Nuxt 3.Specify a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster, tribute from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster oven', Toaster).return deliver: tribute. ).Make use of Toaster part as well as $toast function throughout the Vue SFC.
Provide a toast.
Add the build transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig coming from 'nuxt/config'.export nonpayment defineNuxtConfig( ...construct: transpile: [' vue-sonner'] ).CDN Web link.Ambulance version.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.The majority of simple salute. You can individualize it (as well as any other kind) by passing a choices things as the second argument.tribute(' Celebration has been produced').Along with personalized summary:.toast(' Activity has actually been produced', description: 'Monday, January third at 6:00 pm'. ).Effectiveness.Renders a checkmark symbol in front of the message.toast.success(' Celebration has actually been actually developed').Inaccuracy.Makes an inaccuracy image in front of the notification.toast.error(' Celebration has actually not been developed').Activity.Renders a button.salute(' Event has actually been developed', activity: tag: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Guarantee.Begins in a loading condition and also will certainly update instantly after the promise settles or stops working.You can pass a feature to the success/error notifications to include the result/error of the commitment.toast.promise(() =&gt new Pledge(( fix) =&gt setTimeout( fix, 2000)), filling: 'Packing',.excellence: (data: any kind of) =&gt 'Results',.inaccuracy: (information: any type of) =&gt 'Inaccuracy'. ).Customized Element.You may pass a Vue Part as the initial disagreement instead of a strand to render custom Component while sustaining nonpayment styling. You can make use of the brainless version listed below for a custom, unstyled toast.Customization.Brainless.You may use toast.custom to make an unstyled salute with personalized jsx while preserving the functionality.Theme.You can easily transform the style utilizing the theme set. Nonpayment theme is light.Position.You can easily alter the posture via the posture uphold on the element. Nonpayment is top-right.
Increased.Tributes can easily also be actually grown through default via the extend prop. You can easily additionally transform the volume of apparent salutes which is 3 by default.Styling for all toasts.You can easily design your tributes around the world with the toastOptions prop in the Toaster oven element.Styling for individual toast.salute(' Occasion has actually been actually created', design: background: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close button.Add a near button to all salutes that reveals on hover through including the closeButton uphold.Rich colors.You can produce mistake and also success condition more multicolored by adding the richColors prop.Personalized countered.Offset from the sides of the screen.Programmatically remove salute.To eliminate a tribute programmatically make use of toast.dismiss( id).const toastId = toast(' Celebration has been produced').toast.dismiss( toastId).You can likewise use the put away technique without the i.d. to put away all toasts.toast.dismiss().Programmatically take out toast.You can transform the timeframe of each salute by utilizing the duration attribute, or even change the timeframe of all salutes such as this:.tribute(' Occasion has actually been created', length: 10000. ).// Persisent toast.toast(' Celebration has actually been developed', period: Infinity. ).On Shut Callback.You can easily pass onDismiss and onAutoClose callbacks. onDismiss acquires fired when either the shut switch receives clicked on or even the salute is actually swiped. onAutoClose fires when the tribute disappears immediately after it is actually timeout (period set).salute(' Occasion has been actually made', onDismiss: (t) =&gt console.log( 'Salute along with i.d. $ t.id has actually been dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Tribute along with i.d. $ t.id has been closed automatically '). ).Computer keyboard focus.You may concentrate on the toast aspect through pressing u2325/ alt + T. You may bypass it through supplying a selection of event.code market values for each and every secret.Inspiration.sonner - An opinionated salute component for React.