Sleep

Vue- sonner - Vue.js Feed

.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 toast part for Vue. It is actually adjustable, yet styled by nonpayment. Possesses a swipe to reject animation.Installation.To start making use of the collection, install it in your job:.pnpm put in vue-sonner.or even.anecdote add vue-sonner.Usage.For Vue 3.
Leave a salute.
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', Toaster).profits deliver: tribute. ).Use Toaster oven component and also $toast functionality anywhere in the Vue SFC.
Leave a salute.
Add the develop transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig from 'nuxt/config'.export default defineNuxtConfig( ...build: 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.Nonpayment.A lot of standard salute. You may customize it (and also any other kind) through passing a possibilities things as the second disagreement.tribute(' Occasion has been actually made').Along with custom description:.salute(' Occasion has actually been actually created', explanation: 'Monday, January third at 6:00 pm'. ).Excellence.Provides a checkmark image in front of the notification.toast.success(' Activity has been produced').Mistake.Leaves an inaccuracy icon before the message.toast.error(' Activity has actually certainly not been created').Activity.Renders a switch.tribute(' Occasion has been made', activity: tag: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Assurance.Begins in a loading condition and also is going to update immediately after the pledge resolves or even falls short.You may pass a feature to the success/error notifications to include the result/error of the pledge.toast.promise(() =&gt new Pledge(( fix) =&gt setTimeout( fix, 2000)), packing: 'Packing',.effectiveness: (records: any kind of) =&gt 'Results',.mistake: (records: any) =&gt 'Mistake'. ).Custom Component.You may pass a Vue Part as the first debate rather than a cord to provide custom Part while keeping nonpayment designing. You can easily utilize the brainless variation below for a customized, unstyled toast.Customization.Brainless.You can easily make use of toast.custom to render an unstyled salute with personalized jsx while keeping the performance.Style.You can alter the style making use of the concept set. Default style is actually light.Placement.You can modify the placement with the placement prop on the part. Nonpayment is actually top-right.
Broadened.Salutes may additionally be expanded through nonpayment through the grow set. You can easily likewise change the quantity of visible toasts which is 3 by default.Styling for all salutes.You can easily type your toasts worldwide with the toastOptions prop in the Toaster element.Styling for personal salute.salute(' Activity has been created', design: background: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close button.Incorporate a close switch to all salutes that reveals on hover through incorporating the closeButton prop.Rich different colors.You can create error as well as results condition a lot more vivid through including the richColors uphold.Customized balanced out.Countered coming from the sides of the screen.Programmatically clear away salute.To get rid of a salute programmatically utilize toast.dismiss( i.d.).const toastId = salute(' Occasion has been generated').toast.dismiss( toastId).You can easily additionally use the dismiss strategy without the id to dismiss all toasts.toast.dismiss().Programmatically remove tribute.You can alter the period of each salute by utilizing the length property, or change the period of all tributes such as this:.tribute(' Activity has been made', period: 10000. ).// Persisent salute.salute(' Celebration has been actually produced', length: Immensity. ).On Close Callback.You can easily pass onDismiss and onAutoClose callbacks. onDismiss receives shot when either the shut button receives clicked on or even the tribute is actually wiped. onAutoClose fires when the salute disappears immediately after it is actually timeout (length uphold).tribute(' Activity has been actually created', onDismiss: (t) =&gt console.log( 'Toast along with id $ t.id has actually been dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Salute with i.d. $ t.id has been closed automatically '). ).Keyboard emphasis.You may pay attention to the tribute area through pressing u2325/ alt + T. You may bypass it by providing an assortment of event.code values for each and every trick.Ideas.sonner - An opinionated salute part for React.