Sleep

Vue- sonner - Vue.js Supplied

.An opinionated salute element for Vue. It is actually a Vue port of Sonner.Sneak peek.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Intro.Vue Sonner is actually an opinionated tribute part for Vue. It's adjustable, yet styled by default. Comes with a wipe to dismiss computer animation.Installment.To start making use of the library, install it in your venture:.pnpm set up vue-sonner.or.yarn incorporate vue-sonner.Use.For Vue 3.
Leave a salute.
For Nuxt 3.Define a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster oven, tribute coming from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).come back provide: salute. ).Make use of Toaster element as well as $tribute feature throughout the Vue SFC.
Leave a salute.
Include the construct transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig from 'nuxt/config'.export default defineNuxtConfig( ...create: transpile: [' vue-sonner'] ).CDN Hyperlink.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.Types.Nonpayment.A lot of essential tribute. You can customize it (and some other style) by passing a possibilities object as the second argument.toast(' Activity has been made').With customized summary:.toast(' Occasion has actually been developed', summary: 'Monday, January third at 6:00 pm'. ).Results.Leaves a checkmark icon facing the notification.toast.success(' Celebration has actually been actually made').Inaccuracy.Provides a mistake icon before the notification.toast.error(' Celebration has actually certainly not been actually produced').Action.Provides a switch.tribute(' Activity has actually been actually created', activity: label: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Guarantee.Starts in a filling condition and also will certainly improve immediately after the commitment fixes or even stops working.You can pass a functionality to the success/error notifications to include the result/error of the commitment.toast.promise(() =&gt brand-new Promise(( willpower) =&gt setTimeout( willpower, 2000)), packing: 'Filling',.excellence: (data: any sort of) =&gt 'Results',.error: (information: any kind of) =&gt 'Error'. ).Customized Component.You can pass a Vue Part as the 1st argument rather than a string to render customized Part while keeping nonpayment styling. You may use the brainless model listed below for a custom-made, unstyled salute.Personalization.Headless.You can easily make use of toast.custom to make an unstyled toast with custom-made jsx while preserving the capability.Concept.You may modify the theme making use of the motif set. Default theme is lightweight.Placement.You may transform the placement by means of the posture uphold on the element. Nonpayment is actually top-right.
Grown.Tributes can easily additionally be actually increased by default by means of the grow prop. You may likewise transform the amount of noticeable tributes which is actually 3 by default.Styling for all toasts.You can style your salutes around the globe along with the toastOptions uphold in the Toaster component.Styling for personal toast.salute(' Celebration has actually been created', type: history: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close button.Add a close switch to all toasts that reveals on hover through adding the closeButton uphold.Rich colours.You can create error as well as excellence condition even more vivid through incorporating the richColors set.Customized balanced out.Offset from the sides of the monitor.Programmatically remove tribute.To get rid of a tribute programmatically use toast.dismiss( i.d.).const toastId = tribute(' Activity has actually been actually made').toast.dismiss( toastId).You can easily additionally utilize the put away strategy without the i.d. to put away all tributes.toast.dismiss().Programmatically remove toast.You can change the length of each tribute by utilizing the duration property, or transform the duration of all toasts such as this:.tribute(' Activity has been generated', timeframe: 10000. ).// Persisent salute.toast(' Occasion has been actually generated', length: Immensity. ).On Close Callback.You can easily pass onDismiss and onAutoClose callbacks. onDismiss gets fired when either the close button obtains clicked on or the toast is actually wiped. onAutoClose fires when the toast goes away automatically after it is actually timeout (duration prop).tribute(' Celebration has actually been developed', onDismiss: (t) =&gt console.log( 'Tribute along with i.d. $ t.id has been actually dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Tribute along with id $ t.id has been actually closed instantly '). ).Computer keyboard concentration.You can pay attention to the salute aspect through pushing u2325/ alt + T. You can override it by offering a variety of event.code worths for each and every secret.Creativity.sonner - An opinionated tribute element for React.