Sleep

Vue- sonner - Vue.js Feed

.An opinionated tribute part for Vue. It is actually a Vue port of Sonner.Examine.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Introduction.Vue Sonner is an opinionated tribute element for Vue. It's adjustable, yet styled through nonpayment. Possesses a swipe to dismiss animation.Installation.To begin utilizing the library, install it in your task:.pnpm mount vue-sonner.or even.anecdote add vue-sonner.Usage.For Vue 3.
Render a salute.
For Nuxt 3.Specify a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster oven, toast from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).profits provide: tribute. ).Use Toaster oven part and also $salute function throughout the Vue SFC.
Leave a toast.
Add the construct transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig from 'nuxt/config'.export default defineNuxtConfig( ...develop: transpile: [' vue-sonner'] ).CDN Hyperlink.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 standard salute. You can easily customize it (as well as every other type) by passing an alternatives item as the 2nd argument.salute(' Occasion has been created').Along with custom-made description:.salute(' Occasion has been created', explanation: 'Monday, January third at 6:00 pm'. ).Results.Leaves a checkmark icon before the notification.toast.success(' Activity has been made').Mistake.Renders an inaccuracy symbol before the message.toast.error(' Event has certainly not been actually developed').Action.Provides a button.toast(' Event has actually been actually produced', activity: label: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Commitment.Begins in a packing condition and will improve instantly after the guarantee resolves or fails.You can easily pass a functionality to the success/error information to combine the result/error of the guarantee.toast.promise(() =&gt new Commitment(( willpower) =&gt setTimeout( willpower, 2000)), loading: 'Filling',.excellence: (data: any kind of) =&gt 'Results',.error: (data: any sort of) =&gt 'Inaccuracy'. ).Personalized Component.You can pass a Vue Component as the first disagreement rather than a cord to leave customized Element while maintaining default designing. You can use the headless version listed below for a custom, unstyled toast.Modification.Brainless.You can utilize toast.custom to make an unstyled tribute along with customized jsx while sustaining the capability.Style.You can change the concept utilizing the theme set. Default theme is lightweight.Placement.You may modify the placement via the position uphold on the part. Default is actually top-right.
Broadened.Salutes can easily additionally be extended by default with the grow prop. You may likewise modify the volume of obvious tributes which is 3 by nonpayment.Styling for all toasts.You can type your tributes internationally along with the toastOptions set in the Toaster element.Styling for individual toast.salute(' Celebration has been made', type: history: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near button.Include a close switch to all tributes that presents on hover through including the closeButton prop.Rich colors.You can easily produce error and also results state even more vivid through including the richColors uphold.Customized made up for.Made up for from the sides of the display screen.Programmatically remove toast.To take out a toast programmatically make use of toast.dismiss( id).const toastId = salute(' Activity has actually been made').toast.dismiss( toastId).You can additionally utilize the put away technique without the id to dismiss all toasts.toast.dismiss().Programmatically eliminate tribute.You can modify the timeframe of each toast by utilizing the length home, or even alter the duration of all toasts enjoy this:.tribute(' Occasion has been generated', period: 10000. ).// Persisent tribute.salute(' Celebration has been actually generated', duration: Infinity. ).On Shut Callback.You may pass onDismiss and also onAutoClose callbacks. onDismiss acquires discharged when either the near button receives clicked on or the tribute is actually wiped. onAutoClose fires when the salute vanishes instantly after it is actually timeout (timeframe prop).toast(' Celebration has actually been generated', onDismiss: (t) =&gt console.log( 'Tribute along with id $ t.id has actually been actually disregarded '),.onAutoClose: (t) =&gtconsole.log( 'Salute along with id $ t.id has actually been shut immediately '). ).Keyboard focus.You may concentrate on the tribute field through pressing u2325/ alt + T. You can bypass it through delivering an assortment of event.code values for every key.Ideas.sonner - An opinionated salute part for React.