Sleep

Vue- sonner - Vue.js Feed

.An opinionated tribute 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.Intro.Vue Sonner is actually an opinionated salute component for Vue. It is actually customizable, but designated through default. Comes with a wipe to dismiss animation.Installment.To begin utilizing the library, mount it in your venture:.pnpm set up vue-sonner.or even.yarn include vue-sonner.Usage.For Vue 3.
Provide a toast.
For Nuxt 3.Describe a nuxt plugin.// plugins/sonner. client.ts.import Toaster, tribute from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).profits provide: tribute. ).Use Toaster oven component as well as $tribute feature throughout the Vue SFC.
Leave a toast.
Include the develop transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig from 'nuxt/config'.export nonpayment defineNuxtConfig( ...construct: transpile: [' vue-sonner'] ).CDN Link.EMS model.https://cdn.jsdelivr.net/npm/vue-sonner/+esm.UMD model.https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs.Kinds.Nonpayment.Many general salute. You may personalize it (and every other kind) through passing an options object as the 2nd argument.salute(' Activity has actually been developed').Along with customized summary:.tribute(' Celebration has actually been actually developed', description: 'Monday, January 3rd at 6:00 pm'. ).Results.Makes a checkmark icon facing the message.toast.success(' Activity has actually been generated').Mistake.Leaves a mistake icon before the notification.toast.error(' Celebration has actually certainly not been generated').Activity.Renders a button.toast(' Activity has actually been created', activity: tag: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Pledge.Begins in a filling state and also is going to update immediately after the guarantee settles or falls short.You may pass a feature to the success/error messages to combine the result/error of the pledge.toast.promise(() =&gt new Assurance(( willpower) =&gt setTimeout( willpower, 2000)), filling: 'Loading',.excellence: (information: any kind of) =&gt 'Effectiveness',.error: (records: any) =&gt 'Error'. ).Personalized Component.You can pass a Vue Component as the initial argument instead of a strand to provide customized Component while sustaining nonpayment styling. You can utilize the headless version listed below for a custom, unstyled salute.Modification.Brainless.You can use toast.custom to render an unstyled toast with personalized jsx while sustaining the functions.Style.You may change the theme utilizing the style prop. Default style is lightweight.Posture.You can change the posture by means of the posture prop on the component. Default is actually top-right.
Grown.Tributes can additionally be actually increased by default via the increase prop. You can easily also transform the volume of noticeable tributes which is 3 through default.Styling for all toasts.You may type your tributes internationally along with the toastOptions prop in the Toaster oven component.Designing for specific salute.tribute(' Event has actually been actually generated', style: history: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near switch.Add a close switch to all salutes that reveals on hover through adding the closeButton set.Rich different colors.You can produce inaccuracy and effectiveness state even more colorful through adding the richColors prop.Custom countered.Balanced out coming from the edges of the screen.Programmatically take out salute.To take out a toast programmatically make use of toast.dismiss( i.d.).const toastId = salute(' Occasion has been developed').toast.dismiss( toastId).You can easily also make use of the dismiss technique without the i.d. to dismiss all salutes.toast.dismiss().Programmatically get rid of salute.You can change the timeframe of each tribute by utilizing the length characteristic, or alter the timeframe of all tributes like this:.toast(' Event has actually been actually produced', duration: 10000. ).// Persisent tribute.toast(' Activity has actually been actually produced', period: Infinity. ).On Shut Callback.You can easily pass onDismiss as well as onAutoClose callbacks. onDismiss obtains shot when either the near button gets clicked on or the tribute is wiped. onAutoClose fires when the salute goes away instantly after it is actually timeout (timeframe prop).toast(' Activity has actually been produced', onDismiss: (t) =&gt console.log( 'Salute along with i.d. $ t.id has actually been actually dismissed '),.onAutoClose: (t) =&gtconsole.log( 'Toast with id $ t.id has actually been finalized immediately '). ).Computer keyboard concentration.You may concentrate on the toast aspect through pressing u2325/ alt + T. You may override it through providing an assortment of event.code market values for each and every key.Inspiration.sonner - An opinionated tribute part for React.