Sleep

Vue- sonner - Vue.js Supplied

.An opinionated tribute element for Vue. It's a Vue slot of Sonner.Preview.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Overview.Vue Sonner is actually an opinionated tribute component for Vue. It's personalized, however designated by default. Features a wipe to disregard computer animation.Setup.To begin making use of the public library, install it in your task:.pnpm put in vue-sonner.or.yarn include vue-sonner.Usage.For Vue 3.
Provide a tribute.
For Nuxt 3.Describe a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster, toast from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).return provide: toast. ).Make use of Toaster part and $toast functionality throughout the Vue SFC.
Render a toast.
Include the construct transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig from 'nuxt/config'.export nonpayment defineNuxtConfig( ...build: transpile: [' vue-sonner'] ).CDN 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.Nonpayment.A lot of general salute. You can customize it (and any other type) by passing a choices item as the 2nd debate.salute(' Occasion has been produced').Along with customized explanation:.tribute(' Celebration has actually been actually created', explanation: 'Monday, January third at 6:00 pm'. ).Success.Leaves a checkmark image in front of the notification.toast.success(' Celebration has actually been produced').Mistake.Provides a mistake symbol in front of the notification.toast.error(' Celebration has actually not been actually produced').Activity.Presents a button.salute(' Activity has actually been actually made', activity: label: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Assurance.Starts in a loading condition and also will certainly update automatically after the pledge deals with or even stops working.You may pass a function to the success/error information to integrate the result/error of the pledge.toast.promise(() =&gt new Assurance(( fix) =&gt setTimeout( resolve, 2000)), loading: 'Loading',.results: (data: any type of) =&gt 'Results',.error: (information: any) =&gt 'Error'. ).Personalized Element.You may pass a Vue Part as the first argument instead of a string to render custom Part while sustaining nonpayment styling. You can use the brainless model listed below for a personalized, unstyled toast.Modification.Headless.You may use toast.custom to provide an unstyled tribute with customized jsx while preserving the functions.Style.You can modify the motif utilizing the motif set. Default concept is lightweight.Setting.You can easily change the position through the setting uphold on the part. Nonpayment is top-right.
Broadened.Tributes can easily also be actually extended by default through the broaden set. You can easily additionally change the amount of apparent salutes which is 3 by default.Styling for all tributes.You can design your toasts around the globe with the toastOptions uphold in the Toaster component.Styling for private salute.salute(' Celebration has been produced', design: background: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near button.Include a near switch to all toasts that presents on hover by adding the closeButton set.Rich colors.You may help make inaccuracy and excellence condition extra multicolored by adding the richColors set.Custom-made countered.Offset coming from the edges of the display screen.Programmatically remove toast.To clear away a tribute programmatically make use of toast.dismiss( id).const toastId = toast(' Event has been actually created').toast.dismiss( toastId).You can easily likewise use the put away approach without the id to dismiss all toasts.toast.dismiss().Programmatically get rid of salute.You can easily change the period of each toast by using the period feature, or even transform the period of all salutes enjoy this:.salute(' Event has actually been created', length: 10000. ).// Persisent salute.salute(' Celebration has actually been actually produced', duration: Infinity. ).On Shut Callback.You can easily pass onDismiss and also onAutoClose callbacks. onDismiss obtains axed when either the shut button gets clicked on or even the toast is swiped. onAutoClose fires when the salute fades away automatically after it is actually timeout (length set).toast(' Occasion has actually been made', onDismiss: (t) =&gt console.log( 'Tribute along with id $ t.id has been dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Tribute along with id $ t.id has been closed immediately '). ).Key-board focus.You can concentrate on the salute area through pressing u2325/ alt + T. You can easily override it by delivering a selection of event.code worths for every secret.Creativity.sonner - An opinionated toast part for React.