Sleep

Vue- sonner - Vue.js Supplied

.An opinionated salute element for Vue. It is actually a Vue slot of Sonner.Preview.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Overview.Vue Sonner is actually an opinionated tribute component for Vue. It's adjustable, yet designated by nonpayment. Features a swipe to reject animation.Installation.To start utilizing the library, install it in your venture:.pnpm install vue-sonner.or.anecdote add vue-sonner.Consumption.For Vue 3.
Render a toast.
For Nuxt 3.Define a nuxt plugin.// plugins/sonner. client.ts.import Toaster oven, toast from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster oven', Toaster Oven).profits supply: tribute. ).Usage Toaster component and $tribute function anywhere in the Vue SFC.
Make a tribute.
Include the create transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig coming 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.Styles.Nonpayment.Most simple tribute. You may individualize it (as well as every other type) through passing a choices object as the second debate.salute(' Celebration has been developed').With custom summary:.toast(' Event has actually been made', summary: 'Monday, January third at 6:00 pm'. ).Effectiveness.Leaves a checkmark image before the message.toast.success(' Event has actually been developed').Error.Renders a mistake image facing the notification.toast.error(' Occasion has not been generated').Activity.Provides a button.tribute(' Occasion has been actually generated', action: tag: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Commitment.Begins in a packing state and also will certainly upgrade instantly after the promise fixes or even falls short.You may pass a function to the success/error notifications to incorporate the result/error of the guarantee.toast.promise(() =&gt new Assurance(( willpower) =&gt setTimeout( willpower, 2000)), loading: 'Loading',.results: (records: any type of) =&gt 'Effectiveness',.inaccuracy: (information: any) =&gt 'Mistake'. ).Customized Element.You can pass a Vue Part as the very first debate rather than a strand to provide customized Component while sustaining default designing. You can easily use the headless model below for a custom, unstyled salute.Personalization.Brainless.You may utilize toast.custom to make an unstyled salute with customized jsx while keeping the performance.Concept.You may transform the concept making use of the motif prop. Nonpayment concept is actually light.Posture.You may modify the position via the placement prop on the part. Nonpayment is actually top-right.
Expanded.Salutes may additionally be extended by nonpayment through the expand uphold. You can easily additionally change the volume of noticeable tributes which is 3 by default.Designing for all tributes.You can type your toasts around the globe along with the toastOptions uphold in the Toaster part.Designing for individual salute.toast(' Occasion has been actually made', design: background: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near switch.Include a close switch to all salutes that reveals on hover by adding the closeButton set.Rich different colors.You can easily produce inaccuracy and also results condition much more colorful by incorporating the richColors prop.Custom offset.Countered coming from the edges of the display.Programmatically get rid of salute.To clear away a salute programmatically make use of toast.dismiss( id).const toastId = tribute(' Event has actually been created').toast.dismiss( toastId).You can additionally utilize the put away strategy without the i.d. to dismiss all salutes.toast.dismiss().Programmatically remove toast.You may alter the duration of each toast by utilizing the period property, or modify the period of all tributes enjoy this:.tribute(' Occasion has been made', period: 10000. ).// Persisent toast.salute(' Occasion has been created', timeframe: Immensity. ).On Close Callback.You can pass onDismiss and also onAutoClose callbacks. onDismiss gets fired when either the close button receives clicked on or even the salute is wiped. onAutoClose fires when the salute goes away instantly after it's timeout (timeframe uphold).toast(' Celebration has actually been produced', onDismiss: (t) =&gt console.log( 'Tribute along with id $ t.id has been disregarded '),.onAutoClose: (t) =&gtconsole.log( 'Tribute with i.d. $ t.id has actually been shut instantly '). ).Key-board emphasis.You can easily pay attention to the salute field by pushing u2325/ alt + T. You can easily bypass it through offering a variety of event.code market values for every secret.Inspiration.sonner - An opinionated salute element for React.