Sleep

Vue- sonner - Vue.js Feed

.An opinionated tribute element for Vue. It's a Vue port of Sonner.Sneak peek.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Overview.Vue Sonner is an opinionated tribute element for Vue. It is actually customizable, but styled through nonpayment. Comes with a swipe to reject computer animation.Installation.To start making use of the library, mount it in your project:.pnpm set up vue-sonner.or.yarn add vue-sonner.Consumption.For Vue 3.
Make a tribute.
For Nuxt 3.Describe a nuxt plugin.// plugins/sonner. client.ts.import Toaster oven, salute coming from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster Oven).return deliver: salute. ).Use Toaster element as well as $toast functionality anywhere in the Vue SFC.
Provide a tribute.
Include the create transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig from 'nuxt/config'.export default defineNuxtConfig( ...create: transpile: [' vue-sonner'] ).CDN Web link.Ambulance version.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.Default.Most general toast. You may customize it (as well as some other kind) through passing an options things as the 2nd disagreement.salute(' Occasion has actually been generated').With customized explanation:.tribute(' Occasion has actually been created', description: 'Monday, January 3rd at 6:00 pm'. ).Success.Makes a checkmark symbol in front of the information.toast.success(' Activity has actually been generated').Inaccuracy.Leaves an inaccuracy symbol facing the information.toast.error(' Event has actually not been actually produced').Action.Presents a button.tribute(' Celebration has been produced', action: label: 'Undo',.onClick: () =&gt console.log(' Undo'). ).Assurance.Starts in a packing state and will upgrade immediately after the pledge resolves or even stops working.You can pass a functionality to the success/error messages to include the result/error of the assurance.toast.promise(() =&gt brand-new Promise(( fix) =&gt setTimeout( willpower, 2000)), loading: 'Packing',.effectiveness: (data: any sort of) =&gt 'Excellence',.inaccuracy: (information: any) =&gt 'Mistake'. ).Personalized Element.You can pass a Vue Part as the very first debate instead of a strand to provide custom-made Element while maintaining nonpayment styling. You can utilize the brainless variation below for a custom, unstyled salute.Modification.Headless.You may utilize toast.custom to make an unstyled salute along with personalized jsx while preserving the capability.Motif.You can alter the style utilizing the concept uphold. Default motif is lightweight.Position.You may transform the placement with the position set on the component. Nonpayment is actually top-right.
Grown.Tributes may additionally be expanded by nonpayment by means of the extend set. You may additionally transform the volume of visible salutes which is 3 by nonpayment.Styling for all salutes.You can easily style your salutes globally along with the toastOptions set in the Toaster oven component.Styling for private salute.salute(' Activity has actually been developed', style: history: 'red'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close switch.Add a near button to all salutes that presents on hover through incorporating the closeButton set.Rich colours.You can easily produce mistake and results state more vivid by including the richColors uphold.Customized countered.Made up for coming from the edges of the monitor.Programmatically get rid of salute.To take out a tribute programmatically utilize toast.dismiss( i.d.).const toastId = salute(' Activity has been created').toast.dismiss( toastId).You can likewise utilize the put away technique without the i.d. to put away all tributes.toast.dismiss().Programmatically get rid of salute.You may modify the duration of each toast by using the timeframe property, or even change the length of all tributes like this:.tribute(' Celebration has actually been actually made', timeframe: 10000. ).// Persisent salute.salute(' Event has been actually made', duration: Infinity. ).On Shut Callback.You may pass onDismiss and also onAutoClose callbacks. onDismiss obtains fired when either the near button receives clicked on or even the toast is swiped. onAutoClose fires when the toast vanishes immediately after it is actually timeout (length uphold).tribute(' Occasion has been actually developed', onDismiss: (t) =&gt console.log( 'Tribute along with id $ t.id has been disregarded '),.onAutoClose: (t) =&gtconsole.log( 'Toast along with i.d. $ t.id has actually been actually shut immediately '). ).Computer keyboard emphasis.You may focus on the toast area through pressing u2325/ alt + T. You may override it by offering a selection of event.code worths for each and every secret.Motivation.sonner - An opinionated tribute component for React.