Sleep

Vue- sonner - Vue.js Supplied

.An opinionated salute component for Vue. It is actually a Vue port of Sonner.Examine.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Intro.Vue Sonner is actually an opinionated salute part for Vue. It is actually customizable, yet styled through default. Possesses a wipe to disregard computer animation.Installation.To start utilizing the public library, mount it in your project:.pnpm put up vue-sonner.or even.yarn include vue-sonner.Consumption.For Vue 3.
Leave a tribute.
For Nuxt 3.Define a nuxt plugin.// plugins/sonner. client.ts.import Toaster oven, salute from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).come back offer: salute. ).Usage Toaster part as well as $salute feature throughout the Vue SFC.
Render a salute.
Include the develop transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig from 'nuxt/config'.export nonpayment defineNuxtConfig( ...create: transpile: [' vue-sonner'] ).CDN Web link.EMS 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.Default.Many essential tribute. You can easily customize it (and every other style) through passing an alternatives things as the second disagreement.tribute(' Occasion has actually been made').With custom description:.salute(' Event has actually been produced', description: 'Monday, January 3rd at 6:00 pm'. ).Success.Provides a checkmark symbol in front of the notification.toast.success(' Celebration has been actually developed').Inaccuracy.Renders an inaccuracy image before the notification.toast.error(' Event has certainly not been generated').Action.Provides a switch.tribute(' Event has been actually produced', action: tag: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Assurance.Begins in a filling state as well as is going to upgrade automatically after the guarantee resolves or fails.You can easily pass a function to the success/error notifications to combine the result/error of the guarantee.toast.promise(() =&gt brand new Pledge(( fix) =&gt setTimeout( resolve, 2000)), filling: 'Loading',.results: (data: any kind of) =&gt 'Excellence',.error: (records: any sort of) =&gt 'Inaccuracy'. ).Custom Element.You can pass a Vue Component as the initial disagreement as opposed to a strand to render personalized Component while preserving default styling. You can use the headless version below for a custom, unstyled toast.Personalization.Brainless.You can easily utilize toast.custom to make an unstyled tribute along with personalized jsx while maintaining the functionality.Theme.You can change the theme utilizing the concept uphold. Nonpayment concept is light.Position.You may modify the position with the position uphold on the part. Nonpayment is actually top-right.
Broadened.Salutes can easily likewise be actually increased by default with the increase prop. You may likewise transform the volume of visible toasts which is actually 3 by default.Styling for all tributes.You can easily design your tributes internationally along with the toastOptions prop in the Toaster oven element.Designing for specific tribute.toast(' Activity has actually been produced', design: background: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close button.Include a near button to all toasts that presents on hover by incorporating the closeButton uphold.Rich colours.You can easily create inaccuracy and effectiveness condition much more multicolored through adding the richColors prop.Custom-made balanced out.Balanced out coming from the sides of the display screen.Programmatically remove salute.To eliminate a salute programmatically make use of toast.dismiss( i.d.).const toastId = tribute(' Occasion has actually been actually produced').toast.dismiss( toastId).You can likewise make use of the dismiss approach without the i.d. to put away all toasts.toast.dismiss().Programmatically remove toast.You may alter the length of each salute by using the timeframe feature, or transform the length of all salutes enjoy this:.salute(' Activity has been created', period: 10000. ).// Persisent toast.salute(' Occasion has actually been actually made', period: Immensity. ).On Close Callback.You can pass onDismiss and also onAutoClose callbacks. onDismiss acquires terminated when either the near switch obtains clicked or even the toast is actually swiped. onAutoClose fires when the toast fades away instantly after it is actually timeout (timeframe set).tribute(' Activity has actually been created', onDismiss: (t) =&gt console.log( 'Toast with i.d. $ t.id has actually been actually disregarded '),.onAutoClose: (t) =&gtconsole.log( 'Tribute along with id $ t.id has been finalized automatically '). ).Keyboard focus.You may concentrate on the toast aspect through pushing u2325/ alt + T. You may bypass it by offering an assortment of event.code market values for each trick.Creativity.sonner - An opinionated toast element for React.