Sleep

Vue- sonner - Vue.js Feed

.An opinionated tribute part for Vue. It's a Vue slot of Sonner.Preview.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Intro.Vue Sonner is an opinionated tribute part for Vue. It's personalized, yet styled through nonpayment. Possesses a wipe to dismiss animation.Installment.To start utilizing the collection, mount it in your task:.pnpm put up vue-sonner.or even.anecdote incorporate vue-sonner.Consumption.For Vue 3.
Make a toast.
For Nuxt 3.Determine a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster oven, toast coming from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster).profits offer: toast. ).Usage Toaster oven element as well as $tribute feature anywhere in the Vue SFC.
Leave a salute.
Incorporate the construct transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig coming from 'nuxt/config'.export default defineNuxtConfig( ...create: transpile: [' vue-sonner'] ).CDN Hyperlink.Ambulance model.https://cdn.jsdelivr.net/npm/vue-sonner/+esm.UMD variation.https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs.Kinds.Default.A lot of standard salute. You can easily tailor it (and every other style) through passing a choices object as the 2nd debate.tribute(' Occasion has been created').Along with custom-made description:.toast(' Celebration has been created', description: 'Monday, January third at 6:00 pm'. ).Success.Provides a checkmark icon before the information.toast.success(' Celebration has actually been actually created').Inaccuracy.Makes a mistake symbol facing the information.toast.error(' Celebration has actually certainly not been actually made').Action.Presents a button.salute(' Occasion has been actually produced', action: tag: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Guarantee.Begins in a loading state and also is going to upgrade immediately after the pledge resolves or fails.You can pass a feature to the success/error messages to combine the result/error of the promise.toast.promise(() =&gt new Assurance(( willpower) =&gt setTimeout( fix, 2000)), loading: 'Loading',.success: (records: any sort of) =&gt 'Effectiveness',.mistake: (data: any kind of) =&gt 'Error'. ).Custom Part.You can easily pass a Vue Part as the initial argument instead of a cord to provide personalized Part while keeping default designing. You can easily use the brainless version below for a customized, unstyled tribute.Personalization.Brainless.You may make use of toast.custom to render an unstyled tribute along with customized jsx while sustaining the capability.Style.You can easily transform the motif making use of the theme set. Default motif is actually light.Placement.You can easily transform the setting with the posture prop on the element. Nonpayment is top-right.
Broadened.Tributes may likewise be actually increased through default by means of the expand uphold. You can easily also alter the volume of apparent toasts which is 3 through default.Designing for all salutes.You can easily design your salutes worldwide along with the toastOptions prop in the Toaster oven element.Styling for personal tribute.tribute(' Celebration has been made', type: background: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near button.Add a near switch to all toasts that shows on hover by including the closeButton set.Rich different colors.You can easily create mistake as well as success state even more colorful by adding the richColors prop.Custom balanced out.Made up for from the sides of the display.Programmatically remove tribute.To clear away a toast programmatically use toast.dismiss( id).const toastId = toast(' Event has been actually developed').toast.dismiss( toastId).You may likewise make use of the put away procedure without the i.d. to dismiss all toasts.toast.dismiss().Programmatically eliminate toast.You can modify the timeframe of each salute by utilizing the length characteristic, or alter the timeframe of all toasts enjoy this:.salute(' Activity has been created', length: 10000. ).// Persisent tribute.tribute(' Event has actually been created', duration: Immensity. ).On Close Callback.You can pass onDismiss and onAutoClose callbacks. onDismiss obtains discharged when either the near button receives hit or even the toast is actually swiped. onAutoClose fires when the toast goes away instantly after it's timeout (timeframe uphold).tribute(' Celebration has actually been created', onDismiss: (t) =&gt console.log( 'Salute with id $ t.id has actually been rejected '),.onAutoClose: (t) =&gtconsole.log( 'Toast with i.d. $ t.id has been actually finalized instantly '). ).Keyboard emphasis.You can easily concentrate on the toast area by pushing u2325/ alt + T. You can easily override it by delivering a variety of event.code market values for each secret.Inspiration.sonner - An opinionated salute element for React.