Sleep

Vue- sonner - Vue.js Feed

.An opinionated salute element for Vue. It is actually a Vue slot of Sonner.Preview.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Intro.Vue Sonner is an opinionated tribute element for Vue. It is actually adjustable, however styled by default. Possesses a wipe to reject computer animation.Installation.To begin using the collection, install it in your project:.pnpm mount vue-sonner.or.yarn include vue-sonner.Use.For Vue 3.
Provide a toast.
For Nuxt 3.Determine a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster oven, toast coming from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster oven', Toaster Oven).come back supply: tribute. ).Use Toaster oven element as well as $salute feature anywhere in the Vue SFC.
Leave a tribute.
Incorporate the create transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig coming from 'nuxt/config'.export default defineNuxtConfig( ...develop: transpile: [' vue-sonner'] ).CDN Link.EMS 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.Default.Many simple salute. You may individualize it (and every other style) by passing a possibilities object as the second disagreement.salute(' Activity has been generated').With custom-made description:.salute(' Occasion has been developed', description: 'Monday, January 3rd at 6:00 pm'. ).Excellence.Renders a checkmark icon facing the message.toast.success(' Event has actually been made').Mistake.Makes an error icon facing the message.toast.error(' Occasion has actually not been made').Action.Presents a switch.toast(' Occasion has actually been actually developed', action: label: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Promise.Begins in a filling state and will certainly update instantly after the commitment deals with or even fails.You can easily pass a feature to the success/error information to integrate the result/error of the promise.toast.promise(() =&gt new Assurance(( resolve) =&gt setTimeout( fix, 2000)), filling: 'Loading',.effectiveness: (information: any sort of) =&gt 'Results',.error: (data: any) =&gt 'Error'. ).Personalized Element.You can easily pass a Vue Part as the very first debate instead of a cord to make customized Part while maintaining default styling. You can use the headless version listed below for a custom-made, unstyled toast.Customization.Brainless.You can easily make use of toast.custom to render an unstyled tribute with personalized jsx while preserving the capability.Motif.You can easily modify the concept utilizing the motif prop. Default style is actually lightweight.Posture.You can easily alter the setting by means of the position uphold on the element. Default is actually top-right.
Grown.Toasts may likewise be grown through nonpayment via the increase uphold. You may likewise change the amount of obvious toasts which is 3 by default.Styling for all salutes.You may type your tributes globally along with the toastOptions set in the Toaster oven element.Styling for personal toast.tribute(' Activity has been actually created', style: history: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near button.Incorporate a near switch to all tributes that shows on hover through incorporating the closeButton set.Rich colors.You may help make mistake and success condition more multicolored through adding the richColors uphold.Custom-made made up for.Countered from the sides of the display.Programmatically clear away tribute.To take out a toast programmatically utilize toast.dismiss( i.d.).const toastId = tribute(' Celebration has actually been actually made').toast.dismiss( toastId).You can likewise use the put away procedure without the i.d. to put away all toasts.toast.dismiss().Programmatically remove toast.You may change the length of each tribute by utilizing the timeframe home, or modify the timeframe of all toasts enjoy this:.salute(' Activity has actually been actually made', period: 10000. ).// Persisent tribute.toast(' Event has been created', timeframe: Immensity. ).On Shut Callback.You may pass onDismiss and also onAutoClose callbacks. onDismiss acquires axed when either the close button receives hit or the tribute is swiped. onAutoClose fires when the salute fades away automatically after it's timeout (length prop).tribute(' Activity has been actually made', onDismiss: (t) =&gt console.log( 'Tribute with i.d. $ t.id has actually been actually dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Salute with i.d. $ t.id has actually been finalized instantly '). ).Computer keyboard emphasis.You can easily concentrate on the toast field by pushing u2325/ alt + T. You can bypass it through giving a range of event.code worths for every trick.Creativity.sonner - An opinionated salute part for React.