Sleep

Vue- sonner - Vue.js Feed

.An opinionated tribute element for Vue. It is actually a Vue slot of Sonner.Sneak peek.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Introduction.Vue Sonner is actually an opinionated tribute element for Vue. It's adjustable, yet styled by nonpayment. Comes with a wipe to reject computer animation.Setup.To begin utilizing the public library, install it in your venture:.pnpm put in vue-sonner.or.anecdote include vue-sonner.Utilization.For Vue 3.
Leave a tribute.
For Nuxt 3.Define a nuxt plugin.// plugins/sonner. client.ts.import Toaster oven, salute from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster).come back deliver: toast. ).Make use of Toaster oven part as well as $toast feature throughout the Vue SFC.
Provide a tribute.
Include the construct transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig from 'nuxt/config'.export default defineNuxtConfig( ...construct: 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.Types.Default.Many general salute. You may tailor it (and some other kind) through passing a choices object as the 2nd argument.tribute(' Event has actually been actually developed').Along with personalized description:.salute(' Celebration has actually been actually developed', summary: 'Monday, January 3rd at 6:00 pm'. ).Success.Provides a checkmark symbol in front of the notification.toast.success(' Occasion has been produced').Mistake.Leaves an error symbol facing the notification.toast.error(' Activity has not been actually developed').Action.Provides a switch.toast(' Activity has been actually made', activity: tag: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Commitment.Starts in a packing condition and also will definitely improve automatically after the assurance fixes or stops working.You can pass a feature to the success/error messages to incorporate the result/error of the guarantee.toast.promise(() =&gt brand-new Commitment(( resolve) =&gt setTimeout( resolve, 2000)), loading: 'Filling',.effectiveness: (information: any sort of) =&gt 'Results',.error: (data: any) =&gt 'Error'. ).Customized Component.You can pass a Vue Element as the initial debate rather than a strand to provide custom Component while maintaining nonpayment designing. You may use the brainless version listed below for a customized, unstyled tribute.Personalization.Headless.You can easily utilize toast.custom to render an unstyled salute with custom-made jsx while preserving the performance.Concept.You can modify the concept making use of the motif set. Default concept is actually lightweight.Posture.You can easily modify the position by means of the placement prop on the element. Nonpayment is actually top-right.
Extended.Salutes can likewise be actually increased through default through the extend set. You can likewise modify the quantity of apparent salutes which is actually 3 by nonpayment.Designing for all salutes.You can easily design your salutes internationally with the toastOptions prop in the Toaster element.Designing for personal toast.salute(' Activity has been actually produced', type: history: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near switch.Add a close switch to all tributes that reveals on hover by adding the closeButton uphold.Rich colors.You can help make inaccuracy and effectiveness state extra vivid through including the richColors uphold.Custom made up for.Offset coming from the sides of the screen.Programmatically clear away tribute.To remove a tribute programmatically make use of toast.dismiss( id).const toastId = salute(' Activity has actually been made').toast.dismiss( toastId).You can easily likewise utilize the put away approach without the id to put away all toasts.toast.dismiss().Programmatically eliminate toast.You can easily change the period of each tribute by utilizing the period attribute, or change the timeframe of all salutes similar to this:.toast(' Event has actually been created', length: 10000. ).// Persisent toast.toast(' Event has been actually made', length: Infinity. ).On Shut Callback.You may pass onDismiss and onAutoClose callbacks. onDismiss gets terminated when either the shut button acquires clicked or the salute is actually swiped. onAutoClose fires when the tribute goes away automatically after it is actually timeout (duration uphold).salute(' Celebration has been actually generated', onDismiss: (t) =&gt console.log( 'Toast along with i.d. $ t.id has actually been actually disregarded '),.onAutoClose: (t) =&gtconsole.log( 'Toast along with id $ t.id has been actually shut automatically '). ).Computer keyboard focus.You can pay attention to the toast aspect by pressing u2325/ alt + T. You can override it through supplying a range of event.code worths for each trick.Motivation.sonner - An opinionated toast component for React.