Sleep

Vue- sonner - Vue.js Nourished

.An opinionated tribute component 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 element for Vue. It's adjustable, however styled through default. Possesses a wipe to dismiss computer animation.Installation.To start utilizing the library, mount it in your job:.pnpm mount vue-sonner.or.anecdote incorporate vue-sonner.Use.For Vue 3.
Leave a toast.
For Nuxt 3.Specify a nuxt plugin.// plugins/sonner. client.ts.import Toaster, salute coming from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster oven', Toaster Oven).profits deliver: toast. ).Usage Toaster oven element and $toast functionality anywhere in the Vue SFC.
Make a salute.
Incorporate the develop transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig coming from 'nuxt/config'.export default defineNuxtConfig( ...create: transpile: [' vue-sonner'] ).CDN Hyperlink.EMS model.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.Default.The majority of general salute. You can customize it (and any other style) by passing an options object as the second debate.tribute(' Event has been actually created').Along with custom description:.salute(' Activity has actually been actually created', summary: 'Monday, January third at 6:00 pm'. ).Results.Makes a checkmark image facing the message.toast.success(' Occasion has been developed').Error.Renders an error image facing the message.toast.error(' Celebration has actually not been made').Action.Provides a button.salute(' Celebration has actually been actually created', action: label: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Commitment.Starts in a loading condition as well as will improve instantly after the promise fixes or even stops working.You can easily pass a feature to the success/error messages to combine the result/error of the commitment.toast.promise(() =&gt new Guarantee(( willpower) =&gt setTimeout( resolve, 2000)), packing: 'Packing',.effectiveness: (data: any) =&gt 'Results',.inaccuracy: (information: any type of) =&gt 'Inaccuracy'. ).Custom-made Element.You can easily pass a Vue Part as the initial disagreement instead of a strand to provide custom-made Component while sustaining default designing. You may use the brainless variation below for a custom-made, unstyled tribute.Personalization.Brainless.You can use toast.custom to provide an unstyled toast with custom jsx while sustaining the functions.Theme.You can easily alter the concept utilizing the concept set. Default theme is actually light.Setting.You can easily alter the setting through the setting uphold on the element. Default is actually top-right.
Grown.Salutes can easily additionally be actually extended through nonpayment through the increase prop. You can easily likewise modify the amount of noticeable tributes which is 3 by nonpayment.Styling for all toasts.You may style your tributes globally with the toastOptions set in the Toaster element.Styling for private salute.tribute(' Event has been actually generated', design: history: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close switch.Incorporate a near button to all salutes that shows on hover through including the closeButton set.Rich colors.You may help make error and effectiveness state a lot more colorful by incorporating the richColors uphold.Custom-made made up for.Balanced out coming from the edges of the display.Programmatically get rid of salute.To get rid of a salute programmatically use toast.dismiss( id).const toastId = salute(' Occasion has actually been produced').toast.dismiss( toastId).You can additionally use the put away procedure without the i.d. to dismiss all salutes.toast.dismiss().Programmatically eliminate tribute.You can easily change the duration of each toast by using the period property, or even transform the duration of all salutes like this:.salute(' Event has actually been actually developed', period: 10000. ).// Persisent salute.salute(' Activity has actually been actually created', timeframe: Immensity. ).On Close Callback.You can pass onDismiss as well as onAutoClose callbacks. onDismiss receives shot when either the close switch obtains clicked on or the toast is wiped. onAutoClose fires when the salute vanishes immediately after it is actually timeout (timeframe set).tribute(' Event has been actually made', onDismiss: (t) =&gt console.log( 'Toast along with i.d. $ t.id has actually been actually disregarded '),.onAutoClose: (t) =&gtconsole.log( 'Tribute with i.d. $ t.id has actually been actually shut instantly '). ).Keyboard focus.You may focus on the salute area through pressing u2325/ alt + T. You can easily bypass it through giving a collection of event.code values for every secret.Inspiration.sonner - An opinionated toast element for React.