Sleep

Vue- sonner - Vue.js Feed

.An opinionated toast element for Vue. It is actually a Vue port of Sonner.Examine.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Introduction.Vue Sonner is an opinionated salute part for Vue. It is actually personalized, yet designated through default. Features a swipe to disregard animation.Installment.To begin using the collection, mount it in your venture:.pnpm put up vue-sonner.or even.yarn add vue-sonner.Usage.For Vue 3.
Leave a salute.
For Nuxt 3.Define a nuxt plugin.// plugins/sonner. client.ts.import Toaster oven, tribute coming from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster).profits supply: tribute. ).Usage Toaster part and $toast function throughout the Vue SFC.
Make a salute.
Include the create transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig from 'nuxt/config'.export nonpayment defineNuxtConfig( ...create: 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.Styles.Nonpayment.Many fundamental salute. You can tailor it (and also any other style) through passing an options object as the 2nd argument.tribute(' Occasion has been developed').Along with personalized summary:.toast(' Event has been made', explanation: 'Monday, January 3rd at 6:00 pm'. ).Effectiveness.Makes a checkmark icon before the notification.toast.success(' Event has been actually developed').Inaccuracy.Provides an error icon before the information.toast.error(' Occasion has not been generated').Action.Provides a button.toast(' Occasion has been generated', activity: tag: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Pledge.Begins in a filling state and will definitely update automatically after the commitment fixes or even neglects.You can easily pass a feature to the success/error messages to include the result/error of the commitment.toast.promise(() =&gt brand new Pledge(( fix) =&gt setTimeout( resolve, 2000)), loading: 'Packing',.results: (data: any kind of) =&gt 'Effectiveness',.inaccuracy: (records: any kind of) =&gt 'Inaccuracy'. ).Customized Component.You may pass a Vue Part as the 1st argument instead of a strand to make custom-made Part while maintaining default styling. You can easily make use of the brainless model listed below for a personalized, unstyled tribute.Customization.Brainless.You can use toast.custom to render an unstyled salute along with custom jsx while keeping the functionality.Theme.You may change the theme using the theme prop. Default theme is actually light.Posture.You may change the placement by means of the setting set on the part. Nonpayment is actually top-right.
Extended.Salutes may additionally be broadened by default with the expand prop. You can also alter the amount of obvious tributes which is actually 3 by default.Styling for all toasts.You can style your tributes around the world along with the toastOptions prop in the Toaster part.Designing for individual salute.toast(' Celebration has been generated', type: history: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near switch.Add a near button to all salutes that reveals on hover by incorporating the closeButton prop.Rich shades.You can produce error as well as success state extra colorful by incorporating the richColors uphold.Custom made up for.Made up for from the sides of the screen.Programmatically take out salute.To take out a tribute programmatically utilize toast.dismiss( id).const toastId = salute(' Event has actually been produced').toast.dismiss( toastId).You may also make use of the dismiss technique without the id to put away all tributes.toast.dismiss().Programmatically take out toast.You may transform the duration of each salute by using the period quality, or modify the timeframe of all tributes similar to this:.toast(' Occasion has actually been produced', period: 10000. ).// Persisent toast.toast(' Event has been actually created', duration: Immensity. ).On Shut Callback.You can easily pass onDismiss as well as onAutoClose callbacks. onDismiss gets shot when either the shut switch receives clicked on or even the toast is wiped. onAutoClose fires when the salute disappears immediately after it's timeout (period set).tribute(' Celebration has actually been actually made', onDismiss: (t) =&gt console.log( 'Tribute along with id $ t.id has actually been actually rejected '),.onAutoClose: (t) =&gtconsole.log( 'Tribute along with id $ t.id has been actually shut immediately '). ).Keyboard concentration.You may pay attention to the toast field by pressing u2325/ alt + T. You can bypass it by offering an array of event.code worths for each secret.Ideas.sonner - An opinionated salute element for React.