Sleep

Vue- sonner - Vue.js Feed

.An opinionated salute part for Vue. It's a Vue slot of Sonner.Sneak peek.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Introduction.Vue Sonner is an opinionated tribute component for Vue. It's personalized, however designated by nonpayment. Includes a swipe to dismiss computer animation.Installment.To start using the library, mount it in your project:.pnpm put up vue-sonner.or even.anecdote include vue-sonner.Use.For Vue 3.
Leave a salute.
For Nuxt 3.Describe a nuxt plugin.// plugins/sonner. client.ts.import Toaster oven, salute coming from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).profits give: tribute. ).Use Toaster oven part and $salute feature throughout the Vue SFC.
Make a salute.
Add the construct transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig from 'nuxt/config'.export nonpayment defineNuxtConfig( ...build: transpile: [' vue-sonner'] ).CDN Link.EMS version.https://cdn.jsdelivr.net/npm/vue-sonner/+esm.UMD variation.https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs.Kinds.Nonpayment.A lot of essential toast. You can personalize it (as well as every other type) through passing a choices things as the 2nd disagreement.tribute(' Occasion has been created').Along with custom description:.salute(' Occasion has been actually generated', explanation: 'Monday, January third at 6:00 pm'. ).Excellence.Makes a checkmark icon in front of the notification.toast.success(' Activity has actually been generated').Error.Makes a mistake image facing the information.toast.error(' Celebration has actually not been actually generated').Activity.Presents a switch.salute(' Occasion has actually been generated', activity: tag: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Promise.Starts in a loading state and also is going to upgrade immediately after the pledge addresses or even neglects.You may pass a feature to the success/error messages to incorporate the result/error of the promise.toast.promise(() =&gt brand-new Guarantee(( resolve) =&gt setTimeout( willpower, 2000)), filling: 'Packing',.success: (data: any type of) =&gt 'Excellence',.mistake: (data: any sort of) =&gt 'Mistake'. ).Customized Part.You may pass a Vue Part as the initial disagreement instead of a strand to provide custom Element while sustaining nonpayment designing. You can easily utilize the brainless model below for a custom, unstyled toast.Customization.Headless.You can make use of toast.custom to provide an unstyled tribute along with custom jsx while maintaining the capability.Concept.You can modify the concept making use of the motif set. Default style is actually lightweight.Setting.You may transform the placement via the position set on the element. Default is top-right.
Increased.Salutes can additionally be broadened through nonpayment with the extend uphold. You can easily also alter the quantity of apparent salutes which is 3 through default.Designing for all tributes.You can style your salutes worldwide with the toastOptions uphold in the Toaster oven element.Styling for private salute.tribute(' Event has actually been actually generated', style: background: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near switch.Include a close switch to all toasts that shows on hover by incorporating the closeButton prop.Rich different colors.You can easily make mistake as well as results condition even more multicolored through including the richColors uphold.Custom-made balanced out.Balanced out coming from the edges of the display screen.Programmatically get rid of tribute.To eliminate a toast programmatically utilize toast.dismiss( id).const toastId = salute(' Activity has actually been actually made').toast.dismiss( toastId).You may additionally utilize the put away strategy without the id to put away all toasts.toast.dismiss().Programmatically eliminate salute.You can easily transform the timeframe of each toast by utilizing the timeframe home, or even modify the length of all tributes enjoy this:.tribute(' Event has actually been actually produced', length: 10000. ).// Persisent salute.tribute(' Activity has been actually created', length: Immensity. ).On Shut Callback.You may pass onDismiss as well as onAutoClose callbacks. onDismiss acquires terminated when either the close switch gets hit or even the salute is actually swiped. onAutoClose fires when the toast goes away immediately after it's timeout (period set).salute(' Activity has been actually generated', onDismiss: (t) =&gt console.log( 'Tribute along with id $ t.id has actually been rejected '),.onAutoClose: (t) =&gtconsole.log( 'Toast along with i.d. $ t.id has been finalized automatically '). ).Key-board focus.You can easily focus on the salute field by pressing u2325/ alt + T. You may bypass it through offering an array of event.code worths for each and every key.Inspiration.sonner - An opinionated tribute element for React.