Sleep

Vue- sonner - Vue.js Feed

.An opinionated tribute part for Vue. It is actually a Vue slot of Sonner.Examine.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Intro.Vue Sonner is actually an opinionated toast element for Vue. It is actually customizable, but styled through nonpayment. Comes with a wipe to disregard animation.Installation.To begin using the library, mount it in your project:.pnpm put in vue-sonner.or.yarn incorporate vue-sonner.Usage.For Vue 3.
Leave a toast.
For Nuxt 3.Specify a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster, tribute coming from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster oven', Toaster).come back give: toast. ).Use Toaster oven part and $toast feature anywhere in the Vue SFC.
Provide a toast.
Incorporate the construct transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig from 'nuxt/config'.export nonpayment defineNuxtConfig( ...develop: transpile: [' vue-sonner'] ).CDN Link.Ambulance version.https://cdn.jsdelivr.net/npm/vue-sonner/+esm.UMD version.https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs.Kinds.Nonpayment.Many fundamental tribute. You can easily customize it (and any other type) by passing a possibilities things as the 2nd disagreement.toast(' Event has actually been developed').With customized description:.salute(' Occasion has actually been generated', explanation: 'Monday, January 3rd at 6:00 pm'. ).Results.Provides a checkmark icon facing the notification.toast.success(' Celebration has been actually created').Inaccuracy.Provides an error image before the information.toast.error(' Celebration has not been actually generated').Action.Renders a button.salute(' Activity has actually been made', activity: tag: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Promise.Starts in a packing condition as well as will certainly upgrade instantly after the guarantee addresses or stops working.You can pass a feature to the success/error information to include the result/error of the guarantee.toast.promise(() =&gt new Promise(( resolve) =&gt setTimeout( willpower, 2000)), filling: 'Packing',.effectiveness: (information: any) =&gt 'Effectiveness',.error: (information: any type of) =&gt 'Error'. ).Personalized Part.You can easily pass a Vue Element as the initial debate rather than a string to make custom-made Component while sustaining nonpayment designing. You can easily make use of the brainless variation listed below for a personalized, unstyled toast.Customization.Headless.You can make use of toast.custom to make an unstyled tribute with customized jsx while preserving the functionality.Theme.You may transform the theme using the theme uphold. Nonpayment style is actually light.Placement.You can change the placement with the setting set on the part. Nonpayment is top-right.
Increased.Salutes may likewise be expanded by nonpayment by means of the extend set. You may also modify the volume of visible salutes which is 3 through nonpayment.Designing for all toasts.You may type your toasts around the globe along with the toastOptions uphold in the Toaster oven component.Styling for private salute.salute(' Occasion has been produced', type: history: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close button.Include a close switch to all tributes that shows on hover by adding the closeButton set.Rich colors.You can produce mistake and excellence condition even more colorful through adding the richColors uphold.Custom-made offset.Made up for coming from the edges of the screen.Programmatically take out toast.To remove a toast programmatically utilize toast.dismiss( id).const toastId = tribute(' Activity has actually been developed').toast.dismiss( toastId).You may likewise utilize the dismiss technique without the id to put away all salutes.toast.dismiss().Programmatically clear away tribute.You can easily alter the period of each salute by utilizing the length quality, or alter the duration of all salutes such as this:.salute(' Occasion has been developed', period: 10000. ).// Persisent toast.salute(' Event has been created', duration: Infinity. ).On Close Callback.You can pass onDismiss and also onAutoClose callbacks. onDismiss acquires axed when either the close button receives hit or even the salute is actually wiped. onAutoClose fires when the tribute disappears instantly after it's timeout (length uphold).toast(' Occasion has actually been actually generated', onDismiss: (t) =&gt console.log( 'Salute with i.d. $ t.id has actually been disregarded '),.onAutoClose: (t) =&gtconsole.log( 'Tribute with id $ t.id has actually been shut automatically '). ).Computer keyboard focus.You can easily concentrate on the salute aspect through pushing u2325/ alt + T. You can bypass it through supplying an array of event.code market values for every secret.Ideas.sonner - An opinionated toast part for React.