Sleep

Vue- sonner - Vue.js Feed

.An opinionated tribute component for Vue. It's 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 tribute component for Vue. It's personalized, however designated by default. Possesses a wipe to dismiss computer animation.Installation.To start making use of the library, mount it in your task:.pnpm put in vue-sonner.or.yarn include 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 default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster oven', Toaster).profits provide: toast. ).Make use of Toaster oven part as well as $toast function anywhere in the Vue SFC.
Leave a toast.
Include the build transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig coming from 'nuxt/config'.export default defineNuxtConfig( ...create: transpile: [' vue-sonner'] ).CDN Web link.Ambulance version.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 simple tribute. You can easily personalize it (as well as some other type) by passing an options item as the second disagreement.salute(' Celebration has been generated').Along with custom-made description:.tribute(' Event has actually been actually made', explanation: 'Monday, January 3rd at 6:00 pm'. ).Effectiveness.Provides a checkmark symbol in front of the notification.toast.success(' Celebration has actually been actually created').Mistake.Provides an error image in front of the information.toast.error(' Celebration has actually not been actually created').Activity.Renders a switch.toast(' Celebration has actually been made', action: tag: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Pledge.Starts in a loading state as well as will update immediately after the guarantee fixes or falls short.You can pass a functionality to the success/error messages to include the result/error of the commitment.toast.promise(() =&gt brand new Commitment(( resolve) =&gt setTimeout( willpower, 2000)), filling: 'Packing',.success: (data: any kind of) =&gt 'Excellence',.inaccuracy: (information: any) =&gt 'Inaccuracy'. ).Personalized Component.You may pass a Vue Part as the initial disagreement rather than a string to make custom-made Element while sustaining default designing. You can use the brainless variation below for a customized, unstyled salute.Customization.Headless.You can easily utilize toast.custom to provide an unstyled salute along with customized jsx while keeping the functions.Motif.You may alter the concept utilizing the theme uphold. Default motif is lightweight.Position.You can transform the placement via the setting uphold on the element. Default is top-right.
Broadened.Salutes can also be extended by nonpayment via the increase set. You can easily likewise transform the volume of obvious salutes which is actually 3 through nonpayment.Designing for all toasts.You may design your tributes around the world along with the toastOptions set in the Toaster oven component.Designing for specific toast.salute(' Event has been actually produced', type: history: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close switch.Include a near button to all salutes that presents on hover through including the closeButton set.Rich colours.You can easily make inaccuracy and also excellence state more vibrant through adding the richColors uphold.Custom balanced out.Balanced out coming from the sides of the display.Programmatically eliminate salute.To clear away a salute programmatically utilize toast.dismiss( i.d.).const toastId = salute(' Celebration has been produced').toast.dismiss( toastId).You can additionally make use of the put away technique without the i.d. to put away all tributes.toast.dismiss().Programmatically eliminate tribute.You can easily change the duration of each tribute by utilizing the duration feature, or transform the duration of all toasts such as this:.toast(' Event has actually been created', timeframe: 10000. ).// Persisent toast.toast(' Celebration has actually been actually developed', duration: Immensity. ).On Close Callback.You can pass onDismiss as well as onAutoClose callbacks. onDismiss acquires terminated when either the near button gets clicked on or the salute is wiped. onAutoClose fires when the toast vanishes automatically after it's timeout (length uphold).salute(' Occasion has been actually generated', onDismiss: (t) =&gt console.log( 'Toast along with id $ t.id has actually been dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Salute along with id $ t.id has actually been finalized instantly '). ).Computer keyboard concentration.You can easily focus on the salute aspect by pushing u2325/ alt + T. You may bypass it by offering an assortment of event.code values for every secret.Motivation.sonner - An opinionated toast element for React.