Sleep

Vue- sonner - Vue.js Supplied

.An opinionated tribute part for Vue. It's a Vue port of Sonner.Sneak peek.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Overview.Vue Sonner is actually an opinionated salute part for Vue. It is actually adjustable, yet styled by nonpayment. Comes with a wipe to reject computer animation.Installation.To start making use of the collection, mount it in your project:.pnpm put in vue-sonner.or.yarn incorporate vue-sonner.Usage.For Vue 3.
Make a toast.
For Nuxt 3.Define a nuxt plugin.// plugins/sonner. client.ts.import Toaster oven, salute from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).profits give: toast. ).Usage Toaster part and $toast function anywhere in the Vue SFC.
Provide a salute.
Incorporate the create transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig coming from 'nuxt/config'.export default defineNuxtConfig( ...create: transpile: [' vue-sonner'] ).CDN Link.Ambulance variation.https://cdn.jsdelivr.net/npm/vue-sonner/+esm.UMD variation.https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs.Styles.Nonpayment.Most simple salute. You can tailor it (and also any other style) by passing a choices item as the 2nd disagreement.tribute(' Occasion has actually been actually created').With custom-made description:.tribute(' Event has actually been made', summary: 'Monday, January 3rd at 6:00 pm'. ).Success.Leaves a checkmark image before the notification.toast.success(' Celebration has actually been developed').Mistake.Makes a mistake icon facing the notification.toast.error(' Activity has not been made').Activity.Renders a switch.toast(' Event has been generated', action: tag: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Assurance.Starts in a filling condition and will improve instantly after the guarantee addresses or fails.You can easily pass a feature to the success/error notifications to incorporate the result/error of the promise.toast.promise(() =&gt new Guarantee(( resolve) =&gt setTimeout( fix, 2000)), filling: 'Packing',.results: (records: any kind of) =&gt 'Excellence',.error: (data: any) =&gt 'Mistake'. ).Customized Element.You can easily pass a Vue Element as the very first debate as opposed to a cord to render custom Part while sustaining nonpayment designing. You may make use of the headless variation listed below for a custom, unstyled salute.Modification.Headless.You may utilize toast.custom to make an unstyled salute with customized jsx while preserving the performance.Style.You may alter the style using the concept uphold. Nonpayment concept is actually light.Posture.You may transform the posture via the position uphold on the element. Nonpayment is top-right.
Broadened.Tributes may likewise be increased through nonpayment through the expand set. You can likewise alter the volume of obvious toasts which is 3 through default.Styling for all salutes.You may style your salutes globally with the toastOptions set in the Toaster component.Styling for private salute.tribute(' Celebration has actually been developed', type: background: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near switch.Include a close button to all toasts that presents on hover through including the closeButton uphold.Rich shades.You can easily make inaccuracy and also effectiveness state a lot more multicolored by incorporating the richColors prop.Custom-made countered.Countered coming from the edges of the screen.Programmatically take out salute.To remove a toast programmatically use toast.dismiss( id).const toastId = toast(' Activity has been generated').toast.dismiss( toastId).You can easily additionally utilize the put away method without the i.d. to put away all toasts.toast.dismiss().Programmatically get rid of tribute.You may transform the timeframe of each salute by utilizing the timeframe attribute, or even modify the period of all salutes such as this:.salute(' Celebration has actually been generated', length: 10000. ).// Persisent salute.salute(' Celebration has been actually developed', length: Infinity. ).On Close Callback.You can pass onDismiss and onAutoClose callbacks. onDismiss acquires axed when either the close switch receives clicked on or even the toast is swiped. onAutoClose fires when the toast disappears immediately after it is actually timeout (timeframe prop).tribute(' Event has been actually made', onDismiss: (t) =&gt console.log( 'Salute with id $ t.id has actually been rejected '),.onAutoClose: (t) =&gtconsole.log( 'Toast with id $ t.id has been finalized immediately '). ).Keyboard emphasis.You can pay attention to the tribute field by pressing u2325/ alt + T. You can override it by providing an assortment of event.code values for each and every trick.Ideas.sonner - An opinionated tribute component for React.