Sleep

Vue- sonner - Vue.js Feed

.An opinionated tribute element for Vue. It's a Vue slot of Sonner.Preview.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 customizable, yet designated by default. Comes with a swipe to dismiss animation.Installation.To start making use of the public library, install it in your project:.pnpm install vue-sonner.or.anecdote incorporate vue-sonner.Usage.For Vue 3.
Provide a salute.
For Nuxt 3.Specify a nuxt plugin.// plugins/sonner. client.ts.import Toaster, tribute coming from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).come back deliver: toast. ).Use Toaster part and $toast feature anywhere in the Vue SFC.
Leave a tribute.
Incorporate the construct transpile for vue-sonner.// nuxt.config.ts.bring in defineNuxtConfig from 'nuxt/config'.export nonpayment defineNuxtConfig( ...build: transpile: [' vue-sonner'] ).CDN Hyperlink.EMS 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.Types.Nonpayment.The majority of basic tribute. You may customize it (as well as some other kind) by passing a possibilities item as the second disagreement.toast(' Celebration has actually been actually developed').Along with customized description:.salute(' Occasion has been made', explanation: 'Monday, January 3rd at 6:00 pm'. ).Results.Leaves a checkmark icon before the information.toast.success(' Occasion has actually been actually generated').Error.Provides an error image in front of the information.toast.error(' Activity has actually certainly not been actually generated').Activity.Presents a switch.tribute(' Event has actually been created', activity: label: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Guarantee.Begins in a packing state and will definitely upgrade automatically after the commitment deals with or even falls short.You can easily pass a feature to the success/error notifications to integrate the result/error of the pledge.toast.promise(() =&gt brand-new Pledge(( resolve) =&gt setTimeout( resolve, 2000)), packing: 'Packing',.success: (records: any kind of) =&gt 'Success',.error: (records: any sort of) =&gt 'Error'. ).Personalized Component.You can pass a Vue Component as the first debate rather than a strand to provide custom Component while keeping default designing. You may use the brainless version listed below for a customized, unstyled toast.Modification.Brainless.You can utilize toast.custom to leave an unstyled toast with custom jsx while preserving the functions.Theme.You can easily transform the motif making use of the concept prop. Default style is actually lightweight.Placement.You can easily alter the placement by means of the position uphold on the element. Nonpayment is actually top-right.
Increased.Toasts can easily additionally be extended by default with the expand prop. You may also modify the volume of noticeable tributes which is actually 3 through default.Designing for all salutes.You can easily style your toasts globally along with the toastOptions set in the Toaster oven part.Styling for specific toast.tribute(' Occasion has been actually made', design: history: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Near switch.Add a near button to all toasts that shows on hover through adding the closeButton prop.Rich colours.You can make inaccuracy and also excellence state much more vivid through including the richColors prop.Custom balanced out.Offset from the sides of the display.Programmatically eliminate toast.To clear away a tribute programmatically make use of toast.dismiss( i.d.).const toastId = salute(' Occasion has been developed').toast.dismiss( toastId).You can easily additionally make use of the dismiss procedure without the id to dismiss all tributes.toast.dismiss().Programmatically get rid of toast.You can easily alter the duration of each salute by utilizing the length attribute, or transform the duration of all salutes like this:.tribute(' Event has actually been actually made', duration: 10000. ).// Persisent toast.toast(' Occasion has been made', length: Immensity. ).On Shut Callback.You can easily pass onDismiss and onAutoClose callbacks. onDismiss receives shot when either the close button receives clicked on or even the salute is actually wiped. onAutoClose fires when the salute goes away immediately after it's timeout (duration set).toast(' Celebration has been produced', onDismiss: (t) =&gt console.log( 'Toast along with id $ t.id has been disregarded '),.onAutoClose: (t) =&gtconsole.log( 'Toast with i.d. $ t.id has actually been actually closed instantly '). ).Keyboard emphasis.You can easily concentrate on the tribute area through pressing u2325/ alt + T. You can override it through supplying a collection of event.code market values for every secret.Creativity.sonner - An opinionated tribute element for React.