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 actually an opinionated salute component for Vue. It's adjustable, however designated through default. Includes a wipe to reject animation.Installation.To start using the library, mount it in your task:.pnpm set up vue-sonner.or even.yarn include vue-sonner.Consumption.For Vue 3.
Provide a tribute.
For Nuxt 3.Define a nuxt plugin.// plugins/sonner. client.ts.import Toaster oven, tribute from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).profits give: salute. ).Use Toaster part and also $tribute function anywhere in the Vue SFC.
Provide a salute.
Add the build transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig coming from 'nuxt/config'.export nonpayment defineNuxtConfig( ...create: transpile: [' vue-sonner'] ).CDN 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.Kinds.Nonpayment.Many essential tribute. You may tailor it (and also any other type) through passing an options object as the 2nd debate.tribute(' Occasion has actually been actually created').With custom description:.tribute(' Activity has been actually produced', summary: 'Monday, January 3rd at 6:00 pm'. ).Effectiveness.Renders a checkmark image before the notification.toast.success(' Activity has been made').Inaccuracy.Renders a mistake icon before the information.toast.error(' Activity has actually certainly not been actually made').Action.Renders a switch.toast(' Activity has been produced', activity: label: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Promise.Begins in a packing state as well as will certainly upgrade instantly after the promise deals with or even falls short.You can easily pass a functionality to the success/error messages to include the result/error of the guarantee.toast.promise(() =&gt brand-new Assurance(( fix) =&gt setTimeout( fix, 2000)), loading: 'Packing',.results: (data: any type of) =&gt 'Success',.inaccuracy: (data: any) =&gt 'Mistake'. ).Custom Component.You may pass a Vue Part as the very first disagreement instead of a string to render custom Element while preserving default designing. You can make use of the headless version below for a customized, unstyled salute.Modification.Headless.You can easily utilize toast.custom to render an unstyled toast along with custom-made jsx while sustaining the performance.Style.You can easily alter the motif using the style uphold. Default theme is light.Position.You can easily change the placement through the posture uphold on the element. Default is top-right.
Extended.Salutes may additionally be actually extended through nonpayment by means of the extend prop. You may likewise modify the quantity of noticeable tributes which is actually 3 through default.Styling for all tributes.You may type your toasts internationally with the toastOptions uphold in the Toaster oven component.Designing for personal toast.tribute(' Event has actually been produced', design: background: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close switch.Incorporate a near switch to all salutes that presents on hover through adding the closeButton set.Rich colours.You can help make mistake and also excellence condition a lot more vivid by incorporating the richColors uphold.Custom-made made up for.Offset coming from the edges of the monitor.Programmatically eliminate tribute.To eliminate a tribute programmatically utilize toast.dismiss( id).const toastId = tribute(' Activity has actually been created').toast.dismiss( toastId).You may also utilize the dismiss technique without the i.d. to put away all toasts.toast.dismiss().Programmatically remove toast.You can change the timeframe of each salute by utilizing the timeframe quality, or modify the period of all toasts like this:.tribute(' Occasion has been actually generated', timeframe: 10000. ).// Persisent toast.salute(' Celebration has been created', timeframe: Immensity. ).On Close Callback.You can pass onDismiss and also onAutoClose callbacks. onDismiss receives terminated when either the close switch gets hit or the salute is actually swiped. onAutoClose fires when the salute vanishes immediately after it is actually timeout (period uphold).salute(' Event has actually been created', onDismiss: (t) =&gt console.log( 'Salute along with i.d. $ t.id has been actually rejected '),.onAutoClose: (t) =&gtconsole.log( 'Toast along with i.d. $ t.id has actually been actually finalized instantly '). ).Key-board concentration.You can easily focus on the toast area through pushing u2325/ alt + T. You can bypass it by offering an assortment of event.code values for each and every secret.Creativity.sonner - An opinionated tribute element for React.

Articles You Can Be Interested In