Sleep

Vue- sonner - Vue.js Feed

.An opinionated tribute component for Vue. It is actually a Vue slot of Sonner.Preview.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Intro.Vue Sonner is actually an opinionated salute component for Vue. It's personalized, but designated by nonpayment. Includes a swipe to disregard animation.Installment.To start using the public library, mount it in your task:.pnpm mount vue-sonner.or even.yarn incorporate vue-sonner.Utilization.For Vue 3.
Make a salute.
For Nuxt 3.Define a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster oven, toast from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).return give: salute. ).Usage Toaster element and $tribute functionality anywhere in the Vue SFC.
Make a salute.
Include the create transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig from 'nuxt/config'.export nonpayment defineNuxtConfig( ...construct: transpile: [' vue-sonner'] ).CDN Hyperlink.Ambulance variation.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.Default.A lot of basic toast. You can easily individualize it (as well as every other type) through passing an options object as the 2nd argument.tribute(' Celebration has actually been actually produced').With custom-made explanation:.tribute(' Occasion has actually been actually produced', summary: 'Monday, January third at 6:00 pm'. ).Effectiveness.Renders a checkmark image facing the information.toast.success(' Celebration has actually been actually produced').Error.Renders a mistake image in front of the information.toast.error(' Activity has not been developed').Activity.Presents a switch.tribute(' Celebration has actually been developed', action: tag: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Guarantee.Begins in a packing state as well as is going to update instantly after the promise addresses or even fails.You can easily pass a functionality to the success/error messages to integrate the result/error of the guarantee.toast.promise(() =&gt brand-new Pledge(( willpower) =&gt setTimeout( resolve, 2000)), filling: 'Filling',.excellence: (information: any) =&gt 'Results',.inaccuracy: (data: any kind of) =&gt 'Inaccuracy'. ).Customized Component.You can pass a Vue Element as the initial argument instead of a strand to make custom-made Component while sustaining default styling. You can easily make use of the brainless variation listed below for a customized, unstyled salute.Personalization.Brainless.You can easily use toast.custom to provide an unstyled tribute along with personalized jsx while sustaining the functionality.Style.You can modify the theme utilizing the theme uphold. Default theme is actually lightweight.Posture.You can easily transform the placement through the position uphold on the part. Nonpayment is top-right.
Expanded.Toasts may likewise be broadened through nonpayment by means of the broaden prop. You can likewise transform the quantity of visible salutes which is actually 3 by nonpayment.Designing for all salutes.You can style your salutes globally along with the toastOptions set in the Toaster element.Designing for specific tribute.tribute(' Celebration has actually been actually developed', style: history: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close switch.Add a near button to all tributes that presents on hover through incorporating the closeButton prop.Rich different colors.You can help make inaccuracy as well as effectiveness state a lot more vivid by including the richColors prop.Custom balanced out.Balanced out from the edges of the display.Programmatically take out toast.To take out a toast programmatically utilize toast.dismiss( i.d.).const toastId = toast(' Event has actually been actually created').toast.dismiss( toastId).You may likewise use the dismiss method without the i.d. to dismiss all tributes.toast.dismiss().Programmatically get rid of toast.You may modify the length of each toast by utilizing the duration home, or even transform the length of all tributes such as this:.toast(' Celebration has been created', period: 10000. ).// Persisent tribute.toast(' Celebration has actually been actually created', timeframe: Immensity. ).On Shut Callback.You may pass onDismiss as well as onAutoClose callbacks. onDismiss gets shot when either the near button receives clicked on or the tribute is actually swiped. onAutoClose fires when the toast vanishes immediately after it is actually timeout (period uphold).toast(' Event has been actually made', onDismiss: (t) =&gt console.log( 'Salute with i.d. $ t.id has been dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Salute with i.d. $ t.id has been actually closed instantly '). ).Computer keyboard emphasis.You can focus on the tribute area through pushing u2325/ alt + T. You can easily bypass it by supplying an array of event.code market values for each key.Motivation.sonner - An opinionated toast element for React.