Sleep

Vue- sonner - Vue.js Supplied

.An opinionated salute 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 actually an opinionated toast part for Vue. It is actually adjustable, however designated by default. Includes a swipe to disregard computer animation.Installation.To start making use of the collection, mount it in your project:.pnpm put in vue-sonner.or.anecdote add vue-sonner.Use.For Vue 3.
Make a tribute.
For Nuxt 3.Define a nuxt plugin.// plugins/sonner. client.ts.import Toaster, salute from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster oven', Toaster).return supply: toast. ).Usage Toaster element and also $salute function anywhere in the Vue SFC.
Provide a tribute.
Incorporate the develop transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig from 'nuxt/config'.export default defineNuxtConfig( ...construct: transpile: [' vue-sonner'] ).CDN Link.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.Nonpayment.Most basic tribute. You may individualize it (and also some other kind) through passing a choices item as the 2nd argument.salute(' Activity has actually been developed').With custom explanation:.salute(' Celebration has actually been actually developed', description: 'Monday, January third at 6:00 pm'. ).Effectiveness.Makes a checkmark symbol facing the information.toast.success(' Occasion has been developed').Error.Renders a mistake image facing the notification.toast.error(' Occasion has actually not been actually generated').Action.Renders a switch.tribute(' Activity has actually been actually produced', activity: tag: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Guarantee.Starts in a packing condition and also will definitely upgrade instantly after the assurance resolves or neglects.You can pass a function to the success/error notifications to incorporate the result/error of the pledge.toast.promise(() =&gt brand-new Guarantee(( willpower) =&gt setTimeout( willpower, 2000)), packing: 'Loading',.excellence: (data: any) =&gt 'Effectiveness',.inaccuracy: (information: any type of) =&gt 'Mistake'. ).Custom Element.You can pass a Vue Element as the first debate as opposed to a strand to provide custom Component while sustaining default styling. You can utilize the headless version listed below for a personalized, unstyled salute.Customization.Brainless.You may utilize toast.custom to provide an unstyled toast with customized jsx while keeping the performance.Theme.You can transform the motif using the motif prop. Default theme is lightweight.Setting.You can change the setting via the position uphold on the element. Default is top-right.
Grown.Toasts can easily likewise be extended through default via the grow uphold. You may likewise transform the quantity of apparent toasts which is actually 3 through nonpayment.Designing for all toasts.You can design your salutes internationally along with the toastOptions prop in the Toaster oven part.Styling for personal toast.salute(' Event has been actually made', design: background: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near button.Include a near switch to all toasts that shows on hover by incorporating the closeButton set.Rich different colors.You can easily help make mistake and results condition extra vibrant by including the richColors uphold.Customized balanced out.Countered from the sides of the display.Programmatically clear away salute.To remove a toast programmatically make use of toast.dismiss( i.d.).const toastId = tribute(' Celebration has been made').toast.dismiss( toastId).You can also use the put away strategy without the id to put away all toasts.toast.dismiss().Programmatically clear away tribute.You can easily transform the timeframe of each tribute by using the period characteristic, or modify the length of all toasts such as this:.salute(' Occasion has actually been produced', period: 10000. ).// Persisent toast.toast(' Event has been made', duration: Immensity. ).On Shut Callback.You may pass onDismiss and onAutoClose callbacks. onDismiss receives discharged when either the near switch obtains clicked or even the toast is actually wiped. onAutoClose fires when the tribute disappears automatically after it's timeout (length set).salute(' Event has actually been actually developed', onDismiss: (t) =&gt console.log( 'Salute with i.d. $ t.id has been disregarded '),.onAutoClose: (t) =&gtconsole.log( 'Tribute along with id $ t.id has been actually finalized automatically '). ).Keyboard emphasis.You can pay attention to the tribute field by pushing u2325/ alt + T. You may bypass it through supplying an array of event.code values for each key.Creativity.sonner - An opinionated salute element for React.