Sleep

Vue- sonner - Vue.js Feed

.An opinionated toast component for Vue. It's a Vue slot of Sonner.Sneak peek.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Intro.Vue Sonner is an opinionated salute part for Vue. It is actually customizable, however styled through nonpayment. Comes with a wipe to dismiss animation.Setup.To start making use of the library, install it in your job:.pnpm put in vue-sonner.or.yarn include vue-sonner.Utilization.For Vue 3.
Make a tribute.
For Nuxt 3.Describe a nuxt plugin.// plugins/sonner. client.ts.import Toaster oven, salute coming from 'vue-sonner'.export nonpayment defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster).return supply: toast. ).Make use of Toaster part and $toast functionality anywhere in the Vue SFC.
Leave a salute.
Include the construct transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig coming from 'nuxt/config'.export nonpayment defineNuxtConfig( ...create: transpile: [' vue-sonner'] ).CDN Link.Ambulance variation.https://cdn.jsdelivr.net/npm/vue-sonner/+esm.UMD model.https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs.Styles.Nonpayment.A lot of general tribute. You may individualize it (and every other style) through passing a choices item as the second debate.salute(' Occasion has actually been generated').With custom-made description:.salute(' Celebration has actually been actually created', summary: 'Monday, January third at 6:00 pm'. ).Effectiveness.Leaves a checkmark image in front of the notification.toast.success(' Event has actually been actually created').Mistake.Makes a mistake image in front of the notification.toast.error(' Event has not been actually created').Activity.Renders a switch.toast(' Event has been made', activity: tag: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Pledge.Starts in a packing condition and also will update automatically after the pledge deals with or stops working.You can pass a feature to the success/error information to include the result/error of the assurance.toast.promise(() =&gt brand new Pledge(( willpower) =&gt setTimeout( fix, 2000)), loading: 'Filling',.effectiveness: (information: any) =&gt 'Success',.mistake: (information: any type of) =&gt 'Inaccuracy'. ).Custom Component.You can pass a Vue Element as the initial argument instead of a strand to provide custom-made Part while sustaining nonpayment styling. You can easily use the brainless version below for a customized, unstyled salute.Modification.Brainless.You may use toast.custom to make an unstyled salute with customized jsx while keeping the performance.Motif.You may change the motif making use of the motif uphold. Nonpayment style is light.Placement.You can easily modify the posture through the posture set on the part. Default is top-right.
Expanded.Salutes may additionally be broadened by default with the increase uphold. You may also modify the volume of visible salutes which is 3 by nonpayment.Styling for all salutes.You may style your toasts around the globe along with the toastOptions uphold in the Toaster oven component.Styling for private toast.tribute(' Occasion has actually been developed', design: background: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close switch.Incorporate a near switch to all toasts that reveals on hover through including the closeButton prop.Rich colours.You can easily create inaccuracy and effectiveness state a lot more multicolored by incorporating the richColors uphold.Personalized countered.Balanced out from the edges of the display.Programmatically take out tribute.To take out a salute programmatically make use of toast.dismiss( i.d.).const toastId = toast(' Occasion has actually been produced').toast.dismiss( toastId).You can easily additionally make use of the dismiss procedure without the id to put away all salutes.toast.dismiss().Programmatically take out tribute.You can alter the timeframe of each salute by utilizing the period quality, or even modify the duration of all tributes enjoy this:.tribute(' Celebration has been created', period: 10000. ).// Persisent toast.toast(' Activity has actually been actually created', duration: Infinity. ).On Shut Callback.You can easily pass onDismiss and also onAutoClose callbacks. onDismiss gets discharged when either the shut button obtains clicked on or the tribute is actually wiped. onAutoClose fires when the toast fades away immediately after it is actually timeout (timeframe uphold).salute(' Occasion has actually been generated', onDismiss: (t) =&gt console.log( 'Tribute along with i.d. $ t.id has actually been dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Toast with i.d. $ t.id has actually been actually shut immediately '). ).Keyboard emphasis.You can focus on the tribute aspect by pressing u2325/ alt + T. You can easily override it by giving a collection of event.code market values for every secret.Motivation.sonner - An opinionated tribute part for React.