Sleep

Vue- sonner - Vue.js Supplied

.An opinionated salute component for Vue. It is actually a Vue slot of Sonner.Sneak peek.https://user-images.githubusercontent.com/6118824/228208185-be5aefd4-7fa8-4f95-a41c-88a60c0e2800.mp4.Introduction.Vue Sonner is actually an opinionated salute element for Vue. It is actually customizable, but designated through nonpayment. Includes a swipe to disregard computer animation.Setup.To start making use of the public library, mount it in your project:.pnpm set up vue-sonner.or.yarn include vue-sonner.Consumption.For Vue 3.
Provide a salute.
For Nuxt 3.Determine a nuxt plugin.// plugins/sonner. client.ts.bring in Toaster, tribute from 'vue-sonner'.export default defineNuxtPlugin(( nuxtApp) =&gt nuxtApp.vueApp.component(' Toaster', Toaster).come back offer: toast. ).Usage Toaster oven part and $tribute functionality throughout the Vue SFC.
Leave a toast.
Add the create transpile for vue-sonner.// nuxt.config.ts.import defineNuxtConfig from 'nuxt/config'.export default defineNuxtConfig( ...develop: transpile: [' vue-sonner'] ).CDN Hyperlink.EMS variation.https://cdn.jsdelivr.net/npm/vue-sonner/+esm.UMD variation.https://www.unpkg.com/vue-sonner@0.3.1/lib/vue-sonner.umd.cjs.Styles.Nonpayment.Most general salute. You can easily tailor it (and also any other kind) through passing a choices item as the second argument.toast(' Event has been actually developed').Along with customized explanation:.tribute(' Event has actually been created', summary: 'Monday, January 3rd at 6:00 pm'. ).Success.Renders a checkmark symbol before the message.toast.success(' Event has been actually generated').Error.Leaves a mistake symbol before the message.toast.error(' Occasion has certainly not been actually created').Activity.Provides a button.tribute(' Event has been created', action: tag: 'Reverse',.onClick: () =&gt console.log(' Undo'). ).Pledge.Starts in a filling state and is going to improve instantly after the commitment fixes or even neglects.You can easily pass a feature to the success/error information to include the result/error of the promise.toast.promise(() =&gt brand-new Pledge(( fix) =&gt setTimeout( willpower, 2000)), loading: 'Filling',.success: (data: any kind of) =&gt 'Excellence',.inaccuracy: (information: any type of) =&gt 'Error'. ).Custom Part.You may pass a Vue Component as the first disagreement instead of a strand to make customized Part while preserving default designing. You can use the headless model below for a custom, unstyled salute.Personalization.Brainless.You can make use of toast.custom to leave an unstyled salute along with customized jsx while maintaining the performance.Concept.You can easily change the style making use of the style prop. Nonpayment concept is actually lightweight.Position.You can transform the placement with the position uphold on the component. Nonpayment is actually top-right.
Grown.Tributes can easily also be actually increased through nonpayment via the broaden uphold. You may additionally transform the quantity of visible tributes which is 3 by nonpayment.Styling for all toasts.You may design your toasts internationally with the toastOptions prop in the Toaster component.Designing for specific tribute.salute(' Celebration has been made', style: history: 'reddish'.,.className: 'my-toast',.descriptionClassName: 'my-toast-description'. ).Close button.Add a close switch to all toasts that presents on hover through adding the closeButton uphold.Rich shades.You can easily help make error and effectiveness condition extra multicolored by including the richColors prop.Custom countered.Made up for coming from the sides of the display.Programmatically remove toast.To clear away a tribute programmatically utilize toast.dismiss( i.d.).const toastId = salute(' Celebration has actually been actually created').toast.dismiss( toastId).You can also use the dismiss strategy without the i.d. to put away all tributes.toast.dismiss().Programmatically clear away salute.You can transform the timeframe of each tribute by using the period feature, or even alter the period of all toasts enjoy this:.toast(' Occasion has been actually produced', timeframe: 10000. ).// Persisent toast.salute(' Celebration has actually been actually developed', timeframe: Immensity. ).On Shut Callback.You may pass onDismiss and onAutoClose callbacks. onDismiss obtains axed when either the shut switch acquires clicked on or the tribute is actually swiped. onAutoClose fires when the tribute vanishes instantly after it is actually timeout (duration uphold).tribute(' Celebration has actually been made', onDismiss: (t) =&gt console.log( 'Toast along with id $ t.id has been rejected '),.onAutoClose: (t) =&gtconsole.log( 'Toast along with id $ t.id has actually been finalized automatically '). ).Keyboard concentration.You can concentrate on the tribute field by pressing u2325/ alt + T. You may bypass it through delivering a range of event.code worths for every secret.Creativity.sonner - An opinionated toast component for React.